필터 지우기
필터 지우기

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일)
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