フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I have a cell teste1 that's 1 column and many rows. Each row has a number between 0 and 5. I want to create teste2 cell with the same size that only compares the rows with 0 with some conditions.

1 回表示 (過去 30 日間)
Eduardo Rocha
Eduardo Rocha 2016 年 11 月 9 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
teste2 = teste1;
for k=2:(length(Preos2013S1)-1)
if teste2{k} == '0'
mask = strcmp(catracio1, 'low') & strcmp(catpreco, 'high');
teste2(mask) = {'A'};
mask = strcmp(catracio1, 'medium low') & strcmp(catpreco, 'medium high');
teste2(mask) = {'B'};
mask = strcmp(catracio1, 'medium') & strcmp(catpreco, 'medium');
teste2(mask) = {'C'};
mask = strcmp(catracio1, 'medium high') & strcmp(catpreco, 'medium low');
teste2(mask) = {'D'};
mask = strcmp(catracio1, 'high') & strcmp(catpreco, 'low');
teste2(mask) = {'E'};
else
teste2{k}='V';
end
end
If teste1(k) is 0, it should make those comparisons (2 string cells with the same size as all of these cells). But if none of those are satisfied, teste2(k) should be 0.
If teste1(k) is not 0, it can have a 'V'.
However, what is bugging me is that in some rows that are not 0 in teste1, teste2 is making the comparison anyway. So sometimes I have like C or another comparison result in teste2 that it should not be done. Can somebody please explain me what is wrong?!

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by