フィルターのクリア

two variable in same For loop

1 回表示 (過去 30 日間)
mohammed hussein
mohammed hussein 2017 年 11 月 13 日
コメント済み: mohammed hussein 2017 年 11 月 14 日
Hi
can you please help me with this problem . i want to get two variable change in same time with one another variable . for example i have three variable (A,B,C)i want B and C change at each A . when i run this code gives me error in defined third variable
clear all
clc
AA=[1 2 3];
BB=[4 5 6];
CC=[7 8 9];
for ii=1:1:length(AA)
for jj=1:1:length(BB)& kk=1:1:length(CC)
A=AA(ii);
B=BB(jj);
C=CC(kk);
x=[A,B,C]
end
end
in final i want x give in each loop
X=[1 4 7]
X=[1 5 8]
X=[1 6 9
X=[2 4 7]
X=[2 5 8]
X=[2 6 9]
X=[3 4 7]
X=[3 5 8]
X=[3 6 9]
thank you for your helping

採用された回答

Andrei Bobrov
Andrei Bobrov 2017 年 11 月 13 日
編集済み: Andrei Bobrov 2017 年 11 月 13 日
cb = [AA(:),BB(:),CC(:)];
ii = fullfact([3 3]);
out = [cb(ii(:,2),1),cb(ii(:,1),2:end)];
  1 件のコメント
mohammed hussein
mohammed hussein 2017 年 11 月 14 日
thank you

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by