Operation between Cells-constant-vector-matrix (4D-problem), cell indexing/storing.
1 次查看(过去 30 天)
显示 更早的评论
Hello, I try to do some calculation about 4-D problem, calculating parameter which the value will be different for every coordinate x,y,z. I got stuck in the operation between cell array because different type of variable involved. The operation actually quite simple, but the main problem is about calling the specific element of the vector in specific cell. Here’s some description of the problem:
n as cell index = 1000ea (I have 1000 cells)
G(n)=constants(n)*Vector 3x1 (n)* Matrix 5x5 (n)
I want G as a matrix 5x5(n ea) times 3 So, I will have 1000 G as a Matrix 5x5 in each cell but I have 3 of them. In the end I will have 3000 G. I was thinking that the solution might be creating some loop, but I don’t think I can store them.
First I start with something like this more or less.
if true
for index2=1:3
for index = 1 : 1000
SecondTerm{index};
G{index}=FirstTerm{index}*ans(index2)*ThirdTerm{index};
end
end
end
FirstTerm is constant, SecondTerm is Vector and ThirdTerm is Matrix. The second term represent the z coordinate, whereas for the ThirdTerm represent the x and y coordinate.
This loop only created 1000 G Matrix 5x5. I might need to do something with G-indexing but still can’t find any idea yet. Anybody would like give some suggestion?
Thanks in advance.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!