|
From: | Przemek Klosowski |
Subject: | Re: interpolating large table of data |
Date: | Mon, 23 Sep 2013 16:15:57 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 |
On 09/23/2013 12:39 PM, Dan McMahill
wrote:
I'm trying to do some data interpolation and feel like my code is getting really ugly and it seems there should be a nice clean way. What I have is a multidimensional array:I understand that you have an array like this one: vals=zeros(2,18,64,200) FIrst, the array indices start at zero, so if you could tolerate c=1:64 instead of 0:63 it could simplify things. Next, if the missing a and b values are impossible to interpolate, do you need to include them? Could you simply have a smaller ranges for them, i.e. b from 1 to 13 if b=3,5,8,10,12 are missing? You could store NA (Not Available) in the array slice for the unavailable c: vals(1,13,17,:)=NA and then later find the NA values (isna(vals)) and use the indices to interpolate (or simply fill in the missing values as you are constructing the array). vals(1,13,17,:)=mean([vals(1,13,16,:);vals(1,13,16,:)]) |
[Prev in Thread] | Current Thread | [Next in Thread] |