matrix computations in the loop as cell.

1 ビュー (過去 30 日間)
sermet
sermet 2014 年 5 月 20 日
回答済み: Roger Wohlwend 2014 年 5 月 21 日
coord=[10 12;15 17;20 20;32 32;50 52;44 45;65 69];
v=[1 1.01 1.02;1.01 1.03 1.03;1.11 1.11 1.12;1 1.14 1.12 ;1 1 1;1 1 1;1 1 1];
birim=[1];
count=[3;4];
for k=1:2
if k == 1
row1 = 1;
else
row1 = 1 + sum(count(1:k-1));
end
row2 = sum(count(1:k));
AA{k} =coord(row1:row2, :)
br{k}=repmat(birim,count(k),1)
Lx{k}=v(row1:row2,1)
Ly{k}=v(row1:row2,2)
Lz{k}=v(row1:row2,3)
end
%in here, I wanna compute this algorithm inside the loop;
%for example for k=1;
AA_1=[1 10 12;1 15 17;1 20 20] %br+AA
Lx_1=[1;1.01;1.11]
Ly_1=[1.01;1.03;1.11]
Lz_1=[1.02;1.03;1.12]
x_x1=AA_1*Lx_1 %result1
x_y1=AA_1*Ly_1 %result2
x_z1=AA_1*Lz_1 %result3
%firstly, I cannot merge AA and br matrixes as it look above then I cannot extract them from cell to double in the loop for computations(x_x1,x_y1,x-z1).

採用された回答

Roger Wohlwend
Roger Wohlwend 2014 年 5 月 21 日
In the loop you define AA and br as cell arrays. So, if you want to merge them, use [br{1},AA{1}] and [br{2},AA{2}];

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by