I have a matrix that it is 321*531. It includes NaN values, which i have to eliminate them. Thus, I used this code:
m=~isnan(x);
v=x(m)';
then it turned to 1*75638. I wanna reshape it to 321*531,but I don't know how can I do this.I have tried reshape function,but it doesn't work.
please help me. thanks

댓글 수: 2

José-Luis
José-Luis 2016년 12월 27일
편집: José-Luis 2016년 12월 27일
Well, if there are NaN's and you eliminate them, your matrix can not keep its same shape unless you replace them with something else. What's it gonna be?
Stephen23
Stephen23 2016년 12월 27일
편집: Stephen23 2016년 12월 27일
@navid zed: the number of elements that you have 75638 is not divisible by the number of rows that you want 321:
>> 75638/321
ans = 235.63
What do you imagine happening, should MATLAB magically invent some data to fill in the gap?

댓글을 달려면 로그인하십시오.

답변 (1개)

adi kul
adi kul 2016년 12월 27일

0 개 추천

If you are okay with replacing NaN values with Zeros then:
A(isnan(A))=0
Here A will be your matrix.

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2016년 12월 27일

편집:

2016년 12월 27일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by