필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

constructing a particular "if statement"

조회 수: 1 (최근 30일)
Sabbas
Sabbas 2012년 7월 6일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi,
I have
[N,T,R]=xlsread(name);
R is a cell matrix
N is a double array
R(:,2) contains string variables and zeros.
R(:3) contains NaN and numbers
I want to construct the following "if statement"
if R(:,3) contains zeros OR (R(:,3) contains no zeros AND R(:,2) does not contain only zeros)
N=N
elseif R(:,3) does not contain zero AND R(:,3) contains only NaNs
N=[ zeros(size(R,1),1) N]
else
N=N
end
thanks
[EDITED, code formatted, Jan]
  댓글 수: 9
Sabbas
Sabbas 2012년 7월 7일
could anyone help?
thanks
Jan
Jan 2012년 7월 7일
I asked you already to provide the required information, but you have posted a kind of list, which I cannot use as input for Matlab. The meaning of "R(:,2) and R(:,3) are respectively" is very obvious for you, but a puzzle for anybody, who is not involved in your problem.
In addition you did not answer my question about "N=N".
Instead of adding corrections as comment, it would be much more friendly to the readers of your question, to edit the original question.
Please answer questions for clarifications, post the input of your problem in valid Matlab syntax, such that it can be copied&pasted, add corrections by editing the question and mention any changes by an [EDITED] tip, and please do stop bumping your question repeatedly. When the readers have not been able to answer the question due to a well definition, they cannot offer an answer 3 hours later. Therefore the bumping is annoying.

답변 (1개)

John Petersen
John Petersen 2012년 7월 6일
isnan(x) tests for NaNs (returns a 1 for each NaN, and a 0 otherwise)
(x==0) tests for 0s (returns a 1 for each 0, and 0 otherwise)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by