How to put three coordinates in an element of a matrix?

2 次查看(过去 30 天)
What I'm trying to do is to put the coordinates of velocity vectors into the elements of a 2 dimensional matrix. (That is, I have to store velocity data (3x1 vector) for a rectangular cross section, which is represented by a two dimensional matrix.) After I filled it with velocity data I need to be able to access its elements with for loops.
Any ideas how to do it? Velocity_matrix(i,j) = [Vx Vy Vz] obviously does not work.
I would like to be able to access the elements with something like: for i=1:N for j=1:M W=Velocity_matrix(i,j); ... end end
Thank you for your answers in advance.

采纳的回答

Walter Roberson
Walter Roberson 2012-2-28
Cell arrays
Velocity_matrix{i,j} = [Vx Vy Vz];
and access like
for i=1:N
for j=1:M
W = Velocity_matrix{i,j};
...
end
end
Notice the curly brackets.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by