|
matt dash wrote:
> "Ag " <ag@gmail.com> wrote in message <gdalou$19o$1@fred.mathworks.com>...
>> Because of missing values the last values of the first 3 columns are NaN and the rest of
>> the cells must be filled woth my vector.
> I believe this will do it:
> A=rand(1,97);
> B=nan(10,10);
> B(1:97)=A;
No, in that scheme, the final three -rows- of the final column would be nan,
rather than the last values of the first three -columns-
B = nan(10,10);
nidxes = numel(B) - size(B,2) + (1:3); %if first 3 rows nan
OR
nidxes = numels(B) - 3 + (1:3)); %if last 3 rows nan
B(~ismember(1:numel(B),nidxes)) = A; %if to fill down the columns
I'm stuck at the moment for a one-liner that would fill across the rows instead.
|