フィルターのクリア

for loop

7 ビュー (過去 30 日間)
Kugen Raj
Kugen Raj 2012 年 3 月 22 日
if size(qq)==[1,8]
ff=[(hh(1,1)+qq(1,2))];
ff1=[(hh(1,1)+qq(1,4))];
ff2=[(hh(1,1)+qq(1,6))];
ff3=[(hh(1,1)+qq(1,8))];
aa=kk(ff);
aa1=kk(ff1);
aa2=kk(ff2);
aa3=kk(ff3);
elseif size(qq)==[1,6] / size(qq)==[1,7]
ff=[(hh(1,1)+qq(1,2))];
ff1=[(hh(1,1)+qq(1,4))];
ff2=[(hh(1,1)+qq(1,6))];
aa=kk(ff);
aa1=kk(ff1);
aa2=kk(ff2);
elseif size(qq)==[1,4] / size(qq)==[1,5]
ff=[(hh(1,1)+qq(1,2))];
ff1=[(hh(1,1)+qq(1,4))];
aa=kk(ff);
aa1=kk(ff1);
elseif size(qq)==[1,2] / size(qq)==[1,3]
ff=[(hh(1,1)+qq(1,2))];
aa=kk(ff);
end
based on my coding, i want to calculate (aa-aa3) if the size(qq)=[1,8], (aa-aa2) if size(qq)=[1,6], (aa-aa1) of size(qq)=[1,4] and (aa only) if the size(qq)=[1,2]. Is this code correct because im not sure if it works properly.

回答 (1 件)

Nathan Greco
Nathan Greco 2012 年 3 月 22 日
The only thing that doesn't look right to me is where you have
elseif size(qq)==[1,#] / size(qq)==[1,#+1]
Where # is 6,4,2 Why do you have the second half there? I would get rid of that and just put
elseif size(qq)==[1,#]
And so on. Note: If you wanted to say if size(qq) is less than or equal to [1,3], you would need an | as such:
elseif size(qq)==[1,#] | size(qq)==[1,#+1]
-Nathan
  2 件のコメント
Kugen Raj
Kugen Raj 2012 年 3 月 22 日
how do I put it, if i want to calculate (aa-aa2) in the condition where size(qq)=[1,8] or size(qq)=[1,7]. i will have to put like size(qq)=[1,8] | size(qq)=[1,7] ?
Nathan Greco
Nathan Greco 2012 年 3 月 22 日
Yes, just replace your /'s with |'s.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

タグが未入力です。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by