Help Please : 3 for loops && 3 Dimensional Matrix want them in a 2D GUI Table

1 回表示 (過去 30 日間)
Ahmed
Ahmed 2013 年 2 月 7 日
it is my first question here and i am not a proffisional in matlab but this problem made me crazy Objective: is that i want to output PD(i1,j1,k1)"which is a 3D Matrix" in a 2D GUI Table as i1 j1 k1 changes every loop i am using this function "set(handles.table,'Data']); but i dont know what to define !! 1-i am making 3 for loops in each other
for i1=1:11
statments
for j1=1:18
for k1=1:24
PD(i1,j1,k1)=
PPRL(i1,j1,k1)=
end
end
end
Thanks in Advance
  2 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 7 日
Its not clear, what do you want to display or calculate?
Ahmed
Ahmed 2013 年 2 月 7 日
to display these function for each loop in a different row !, set(handles.table,'Data',[d(i1),S(i1,j1),N(i1,j1,k1),L1(i1),L2(i1),L3(i1),L4(i1),PPRL(i1,j1,k1),PT(i1,j1,k1),PRHP(i1,j1,k1),PD(i1,j1,k1)]);

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

採用された回答

Thorsten
Thorsten 2013 年 2 月 7 日
You can extract a 2D matrix A out of a 3D matrix PD using
A = PD(:, :, 1);
or
A = squeeze(PD(i, :, :))
or
A = squeeze(PD(:, i, :))
Depending on which dimension your outer loop runs that changes i.
In your case you could use
for i1=1:11
A = squeeze(PD(i, :, :));
end
  1 件のコメント
Ahmed
Ahmed 2013 年 2 月 7 日
thats Very helpful, but now i decided not to use a 3 D matrix and put the uitable set function inside the loop so it treats PD(i1,j1,k1) as only one number and put it in a certain column, the Problem now all the data are only in one row.. !! and i want them for all i1 , j1 , k1 , not the last one , can u help me in this ? thanks in Advanve , i am using this function now set(handles.table,'Data',[d(i1),S(i1,j1),N(i1,j1,k1),L1(i1),L2(i1),L3(i1),L4(i1),PPRL(i1,j1,k1),PT(i1,j1,k1),PRHP(i1,j1,k1),PD(i1,j1,k1)]);

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

その他の回答 (0 件)

カテゴリ

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