Mset is a 511x54 double and i would like to store the true or false statement for each iteration. Any advice would be much appreciated.
L=zeros(511,54);
for i=1:511
for j=1:54
if Mset(i,j)==1
L(i,j)='True';
else
L(i,j)='False';
end
end
end

답변 (2개)

KSSV
KSSV 2017년 10월 24일

0 개 추천

L=Mset==1
You don't need a loop for that. Your L will be a logical now.

댓글 수: 1

Elliott Fullerton
Elliott Fullerton 2017년 10월 24일
Thank you KSSV, but I still need 1's to be 'True' and 0's to be 'False' if that makes sense.

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

Jan
Jan 2017년 10월 24일
편집: Jan 2017년 10월 24일

0 개 추천

L = cell(511,54);
L(:) = {'False'};
L(MSet==1) = {'True'};
Or:
Pool = {'False', 'True'};
L = Pool((MSet == 1) + 1);

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2017년 10월 24일

편집:

Jan
2017년 10월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by