필터 지우기
필터 지우기

Plotting data from three dimensional array

조회 수: 5 (최근 30일)
Sandeep Parameshwara
Sandeep Parameshwara 2020년 1월 4일
댓글: Cameron B 2020년 1월 4일
Hello, I have three dimensional array X of size (10,10,21). I want to plot diagonal elements, i.e X(1,1,:),X(2,2,:) etc over parameter Y=-1:0.1:1. How can I use plot command? When I use plot(Y,X(1,1,:)), I get the error
'Error using plot Data cannot have more than 2 dimensions.'
Thank you for the help.

채택된 답변

Cameron B
Cameron B 2020년 1월 4일
It’s because your y array is 1x21 and your x is 1x100. Your dimensions don’t match. Make sure your y variable is correct.
  댓글 수: 2
Sandeep Parameshwara
Sandeep Parameshwara 2020년 1월 4일
Hello Cameron,I edited my question, sorry for the inconvenience. The length of 2d array and size of 3rd dimension of 3d array is same as shown (21). Still,I get the error.
Cameron B
Cameron B 2020년 1월 4일
plot(y,reshape(x(1,1,:),[1,length(y)]))

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by