I have a 3529 x 2 2D matrix. how can I convert it into a 3D matrix? please help.

댓글 수: 2

Guillaume
Guillaume 2018년 2월 28일
More information required. Why do you want it to be 3D? What should the size of the 3D matrix be? Which elements of the 2D matrix should move to the 3rd dimension?
Walter Roberson
Walter Roberson 2018년 2월 28일
What size of output are you expecting?

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

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2018년 2월 28일

0 개 추천

out = reshape(your_matrix,size_of_your_new_3D_matrix)

댓글 수: 7

Walter Roberson
Walter Roberson 2018년 2월 28일
3529 and 2 are both prime so the only way to create a 3d matrix from this through reshape is if one of the three dimensions ends up singular.
saswati bhattacharya
saswati bhattacharya 2018년 3월 1일
Now I have changed the size to 3528 and 2.. help
Walter Roberson
Walter Roberson 2018년 3월 1일
What size of output are you expecting? 42 x 42 x 4 ?
saswati bhattacharya
saswati bhattacharya 2018년 3월 1일
thank you, it worked.. please tell how to plot these data so that i can visualize a 3D effect..
Guillaume
Guillaume 2018년 3월 1일
편집: Guillaume 2018년 3월 1일
Saswati, do you realise that you're not providing enough information at all for us to answer your question and we're left guessing at what you're trying to do? From the little you have said so far we can guess that you may have a 2D matrix of X, Y and Z coordinates. How these are arranged, we don't know. It could be
[X1 Y1 Z1 X2 Y2 Z2 X3 Y3 Z3
X4 Y4 Z4 X5 Y5 Z5 X6 Y6 Z6
.... ]
or
[X1 X4 X6 X9
Y1 Y4 Y6 Y9
Z1 Z4 Z6 Z9
X2 X5 X7 X9
...]
or
[X1 X2 X3 X4 X5 X6
X7 X8 X9 Y1 Y2 Y3
Y4 Y5 ...
or any other arrangment. Any of these requires a different solution to the questions " how can I convert it into a 3D matrix" and "how to plot these data".
For all we know, you don't actually have X, Y, Z but just have
[Z11 Z12 Z13 Z14 Z15 ...
Z21 Z22 Z23 Z24 Z25 ...
...
saswati bhattacharya
saswati bhattacharya 2018년 3월 6일
편집: Walter Roberson 2018년 3월 6일
Thank you
I have a 3528 X 2 matrix.. it is a 2D matrix.. now i want to convert it into 3D matrix.. and then i want to see my data as 3D data..this is the arrangement of data..
10.0083592395139 77.9930054460466
10.0253628539736 55.3153345652150
10.0423676723994 72.9691320996063
Guillaume
Guillaume 2018년 3월 6일
You have yet to explain what any of these numbers represent so we have absolutely no idea how to convert your 2D matrix to 3D.
You really really really need to explain a lot better what it is you want.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by