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!