I have a matrix which looks like A = [1 NaN 1 ; NaN 1 2; NaN 1 2]; How can I remove all NaN's from the A matrix?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Rubel Ahmed
am 7 Nov. 2018
Kommentiert: madhan ravi
am 7 Nov. 2018
A = [1 NaN 1 ; NaN 1 2; NaN 1 2];
0 Kommentare
Akzeptierte Antwort
madhan ravi
am 7 Nov. 2018
Bearbeitet: madhan ravi
am 7 Nov. 2018
A = [1 NaN 1 ; NaN 1 2; NaN 1 2];
A(isnan(A))=[] ;
A = reshape(A,3,2)
command window:
>> COMMUNITY
A =
1 1
1 2
1 2
>>
4 Kommentare
madhan ravi
am 7 Nov. 2018
B = [1 NaN, NaN,3,1;1 NaN, 1,NaN,1;1 NaN, 1,NaN,1;1 NaN, NaN,NaN,1;1 NaN, 2,NaN,1]
B(isnan(B))=[]
a=factor(numel(B));
m = max(a);
n=min(a);
reshape(B,m,n)
Weitere Antworten (2)
Siehe auch
Kategorien
Mehr zu ANOVA 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!