dear community,
I have a 6D result Arr(crb, cefb, crr, crp, ctb, ccb) where Arr(Arr>1)=nan.
How can I find the values of crb, cefb, crr, crp, ctb and ccb, where Arr is not nan?
thanks

댓글 수: 3

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 5월 24일
Can you post your sample data to address your question in a more specific way?
KSSV
KSSV 2021년 5월 24일
Have a look on the function isnan.
Asliddin Komilov
Asliddin Komilov 2021년 5월 24일
I have attached the data, and isnan did not handle the 6D (or I don't know how to do it)

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

 채택된 답변

Jan
Jan 2021년 5월 24일

0 개 추천

isnan is the function, which replies a logical array with the same dimension as the input and TRUE values, where the input has NaN elements. It does handle 6 dimensional arrays.
siz = [2,3,4,5,6,7];
Data = ones(siz); % Some test data
Data(rand(siz) > 0.5) = nan;
index = isnan(Data)
Now use either the logical array directly, or call find() to obtain the index vectors. Maybe ind2sub helps you to get the indices for the different dimensions.

댓글 수: 3

Asliddin Komilov
Asliddin Komilov 2021년 5월 24일
thanks,
actually, i thought it did not work because the result became an array, whereas I have expected 6D. if i understand correctly, you suggest to use ind2sub to get my 6D. Would you please give a link where it is used such way.
thanks
Jan
Jan 2021년 5월 25일
isnan() replies an array of the same size as the input. So if the input has 6 dimensions, the output has 6 dimensions, too.
Please post a piece of code, which reproduces your problem.
ind2sub converts the linear index to the indices related to an array. See: doc ind2sub.
Asliddin Komilov
Asliddin Komilov 2021년 5월 25일
sorry, it was another line that made the error.
actually I needed to use isfinite and it worked exactly as you said.
thanks

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2021년 5월 24일

댓글:

2021년 5월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by