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 view (last 30 days)
Show older comments
A = [1 NaN 1 ; NaN 1 2; NaN 1 2];
0 Comments
Accepted Answer
madhan ravi
on 7 Nov 2018
Edited: madhan ravi
on 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 Comments
madhan ravi
on 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)
More Answers (2)
See Also
Categories
Find more on ANOVA in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!