필터 지우기
필터 지우기

create multidimensional array manually

조회 수: 2 (최근 30일)
Olu adroit
Olu adroit 2016년 1월 15일
답변: Walter Roberson 2016년 1월 15일
Hi guyz, This may seem like a stupid question but please help me. I am trying to create a multidimensional matrix manually but i keep receiving an error message that ''subscripted assignment dimension mismatch'. E.g. i would like to create a 4x4x4 matrix like below. is this not suppose to give me 'myCA' as a 4x4x4 matrix? thanks for your help.
% code
myCA(:,:,1) = [2,2,5,2;2,2,2,2;2,2,2,2;2,2,2,2]
myCA(:,:,2) = [2,2,2,2;2,2,2,2;2,2,2,2;2,2,2,2]
myCA(:,:,3) = [2,2,2,2;2,2,2,2;2,2,2,2;2,2,2,2]
myCA(:,:,4) = [2,2,2,2;2,2,2,2;2,2,2,2;2,2,2,2]

채택된 답변

Walter Roberson
Walter Roberson 2016년 1월 15일
That code works fine pasted into the command line, provided that myCA is not already defined as something with a different shape.
You might also want to consider using cat(3, ....)

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by