How can I store this data?

1 回表示 (過去 30 日間)
Elliott Fullerton
Elliott Fullerton 2017 年 10 月 24 日
編集済み: Jan 2017 年 10 月 24 日
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 日
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 日
L = cell(511,54);
L(:) = {'False'};
L(MSet==1) = {'True'};
Or:
Pool = {'False', 'True'};
L = Pool((MSet == 1) + 1);

カテゴリ

Help Center および File ExchangeAdding custom doc についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by