permute matrix dimensions: getting trickier ...
2 次查看(过去 30 天)
显示 更早的评论
Hi gurus,
i have a multidimensional matrix (M) and want to plot every combination of two of its dimensions in a mesh. Here is the solution we came up with for octave toguether with its community:
% generate matrix M
size=11;
for A=(1:size)
for B=(1:size)
for C=(1:size)
for D=(1:size)
for E=(1:size)
M(A, B, C, D, E) = A*B^2 - C*D^3 +10*E;
end
end
end
end
end
% plot all pair combinations of M dimensions
n = ndims(M);
for i = 1:n
for j = (i+1):n
figure( (i-1)*n + j );
clf;
mesh( 1:size , 1:size ,...
permute( M,[i j (1:n)( (1:n)!=i & (1:n)!=j )] )(:,:,1,1,1) );
xlabel('abcde'(i));
ylabel('abcde'(j));
end
end
The command permute does not work in this form on matlab. I could'nt find a way out. Could u help me?
thx...
0 个评论
回答(2 个)
David Sanchez
2014-3-19
I am a bit confused by the explanation of what you want. Is it something like this?
% plot all pair combinations of M dimensions
n = ndims(M);
for i = 1:size
for j =1:size
for k=1:size
figure();
clf;
[X,Y] = meshgrid(1:size);
mesh(X, Y ,M(:,:,i,j,k));
end
end
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!