Why do I get "Error using plot, Data cannot have more than 2 dimensions"

조회 수: 66 (최근 30일)
Lungile
Lungile 2023년 1월 18일
댓글: Lungile 2023년 2월 6일
I am following the model "Sense Motion Using a Transform Sensor Block" in the Help Center. When I try to plot the figure it gives me this error:
plot(y_link.data, z_link.data, 'color', [60 100 175]/255);
Error using plot
Data cannot have more than 2 dimensions.
I am using Matlab R2022a
  댓글 수: 3
Lungile
Lungile 2023년 1월 18일
Thank you for the the response. Translation has been set to Y and Z in the Translation Sensor and the units have been set to cm on the PS-Simulink Converter blocks in the model
Lungile
Lungile 2023년 1월 18일
@KSSV I got it. I changed the Vector fomart to 1-D array. Thanks for your advice. Regards

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

채택된 답변

Daksh
Daksh 2023년 2월 3일
I understand that you're facing the error: "Error using plot, Data cannot have more than 2 dimensions" in your utility.
We know that MATLAB command "plot(X,Y)" creates a 2-D line plot of the data in Y versus the corresponding values in X.
  • To plot a set of coordinates connected by line segments, specify X and Y as vectors of the same length.
  • To plot multiple sets of coordinates on the same set of axes, specify at least one of X or Y as a matrix.
Kindly navigate to the workspace variables and check the dimensions and data types for both variables "y_link.data" and "z_link.data". Make sure that the data variables have consistent and appropriate dimensions and are 1 dimensional arrays.
Hope it helps!
  댓글 수: 1
Lungile
Lungile 2023년 2월 6일
Good day.
Thank you for your response.
I think there was inconsistance on the dimensions. I changed the Vector fomart on the PS-Simulink converter to 1-D Array. It is not ploting the curve.
Regards

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by