Read vectors into a matrix of NaNs??
3 ビュー (過去 30 日間)
古いコメントを表示
I have a large 25x25 matrix full of "NaN". I created it so that I could put several different 1-dimensional arrays of different lengths into one matrix together. But now I am having issues replacing the NaNs with the elements of the individual arrays.
For example, I have the big matrix "SalMat"
SalMat = repmat({NaN},25,25);
And I would like for sal01 to be the new first column of SalMat:
sal01 =
26.7762
26.7769
26.7773
26.7781
26.8047
27.0839
28.6000
30.5953
32.4578
33.2129
34.0983
34.4630
34.6466
34.6961
34.7120
34.7924
35.4376
35.5727
This would then be repeated with sal02,sal03,....sal25 inserted into the 25 columns of SalMat.
Any suggestions???
0 件のコメント
採用された回答
Sean de Wolski
2011 年 10 月 5 日
repmat({nan},blah)
will replicate a cell of nan. You don't want cells ( doc cell, for more info). You want a regular matrix:
Salmat = nan(25); %same as repmat(nan,25,25);
その他の回答 (1 件)
Andrei Bobrov
2011 年 10 月 5 日
SalMat = nan(25)
c = arrayfun(@(x)randi(randi(123),randi(25),1),1:25,'un',0)
for j1 = 1:size(SalMat,2)
SalMat(1:numel(c{j1}),j1) = c{j1};
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で NaNs についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!