Filling different size vectors with NaN
43 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Inês Mendes
am 6 Jul. 2015
Kommentiert: Inês Mendes
am 6 Jul. 2015
Hi guys!
I am having some trouble filling in a vector with NaN.
I have 2 vectors with different sizes, and i want to make them the same size, by adding NaN in the positions that don't have any value..
For example:
v=[1;2;3;4];
and
j=[5;6];
I want j to become:
j=[5;6;NaN;NaN];
Can anyone help?
Thanks in advance!
Inês
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 6 Jul. 2015
v=[1;2;3;4]
j=[5;6]
n=max(numel(v),numel(j))
v(end+1:n)=nan
j(end+1:n)=nan
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!