Read vectors into a matrix of NaNs??
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Sean de Wolski
am 5 Okt. 2011
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);
Weitere Antworten (1)
Andrei Bobrov
am 5 Okt. 2011
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 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!