Info

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

Calculations on cell pairs that meet multiple pre-defined criteria?

조회 수: 1 (최근 30일)
John
John 2017년 2월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
My goal: Depending on which of the 5 scenarios is prevalent in each row (cell pairs in red, see below), make the calculation following the if statement. End result should be 1 column, including the outcome of each row calc.
What I tried so far:
CalcOutcome = zeros(554,1);
for k=height(MomPF)
if MomPF.L_sum4t<0 & MomPF.U_sum4t>0
% make calc for every row but end result should only be 1 column
% with the calc outcomes
CalcOutcome=(-1)*MomPF.L_sum4t{k}*0.5 + MomPF.U_sum4t{k}*0.5;
elseif MomPF.L_sum4t<0 & MomPF.U_sum4t<0
CalcOutcome=(-1)*MomPF.L_sum4t{k}*1;
elseif MomPF.L_sum4t>0 & MomPF.U_sum4t>0
CalcOutcome=MomPF.U_sum4t{k}*1;
elseif MomPF.L_sum4t>0 & MomPF.U_sum4t<0
CalcOutcome=MomPF.L_sum4t{k}*0.5 + (-1)*MomPF.U_sum4t{k}*0.5;
elseif MomPF.L_sum4t==0 & MomPF.U_sum4t==0
CalcOutcome=0
end
end
Table:

답변 (0개)

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

Community Treasure Hunt

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

Start Hunting!

Translated by