Defining&visualising 3-or-more-dimensional arrays using the Variables/Workspace window

조회 수: 9 (최근 30일)
I'd like to use the Variables/Workspace window to visually define a 3D array consisting of N matrices, by pasting the values of each constituent matrix. The first index of the 3D array would indicate the matrix number, and the remaining two indices would define the matrices themselves.
Problem is, the Variables/Workspace window does not seem too dimensional-friendly, and displays arrays of 3 or more dimensions by enumerating along the final dimension.
Hope I've explained this clearly enough, thanks for any replies! Am using v2016a.

답변 (1개)

Marco Morganti
Marco Morganti 2017년 1월 5일
Hi,
you could use the permute() function to alter the order of the dimensions. In this case, if you want your current third dimension to become the first one you could use the command:
permute(A,[3,1,2])
where A is the matrix you want to change.
  댓글 수: 2
z8080
z8080 2017년 1월 5일
Thanks but how does this allow me to input data into the 3D array matrix by matrix, as I explained?
Marco Morganti
Marco Morganti 2017년 1월 6일
You could concatenate the matrices along the third dimension, so that when visualizing the 3D matrix you would see the original matrices separately:
a = zeros(4);
b = ones(4);
c = 2*ones(4);
cat(3,a,b,c)
ans(:,:,1) =
0 0
0 0
ans(:,:,2) =
1 1
1 1
ans(:,:,3) =
2 2
2 2

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by