필터 지우기
필터 지우기

3 dimension array?

조회 수: 9 (최근 30일)
Henry Buck
Henry Buck 2015년 9월 11일
편집: Stephen23 2015년 9월 11일
Hi, How to write 3 or 4 dimansion array?
Thanks, Henry

채택된 답변

Stephen23
Stephen23 2015년 9월 11일
편집: Stephen23 2015년 9월 11일
Any internet search engine will give these pages at the top of the search results:
MATLAB's documentation is really useful and readable. It tells us how to use MATLAB. It has working examples too. You can search it using your favorite internet search engine: this will find the official, correct and recommended ways of using MATLAB. The first link above includes the title "Creating Multi-Dimensional Arrays" at the top of the page. Perhaps you might like to read this.
Here are three easy ways to create ND arrays:
  • indexing:
>> A(:,:,2) = [1,2;3,4];
>> A(:,:,1) = [9,8;7,6]
A(:,:,1) =
9 8
7 6
A(:,:,2) =
1 2
3 4
  • reshape:
>> X = [9,7,8,6,1,3,2,4];
>> reshape(X,2,2,2)
ans(:,:,1) =
9 8
7 6
ans(:,:,2) =
1 2
3 4
  • cat:
>> X = [1,2;3,4];
>> Y = [9,8;7,6];
>> cat(3,Y,X)
ans(:,:,1) =
9 8
7 6
ans(:,:,2) =
1 2
3 4
  댓글 수: 1
Henry Buck
Henry Buck 2015년 9월 11일
Thanks a lot, Henry

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by