Unrecognized table variable name 'time'
조회 수: 25 (최근 30일)
이전 댓글 표시
MOHAMMAD ABDUL MOKTADIR CHOWDHURY
2021년 3월 27일
댓글: MOHAMMAD ABDUL MOKTADIR CHOWDHURY
2021년 3월 27일
Hi, I want to plot a time space diagram showing speed. First row is postmile (yvar), first row, first column is time (xvar), and other value are cvar.
I have writhe the readtable function. In workspace time table is there but I got the following error message:
My code and error message:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/564121/image.jpeg)
Snapshot of my heatmap3.csv file
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/564126/image.jpeg)
Could you please advise what's wrong wiht my code?
Thanks
댓글 수: 0
채택된 답변
Walter Roberson
2021년 3월 27일
Your csv file happears to have no header line, so the variable names created are Var1, Var2, and so on.
You are also attempting to color according to an array, not according to a single variable.
time = T{2:end,1};
postmile = T{1,2:end};
speed = T{2:end,2:end};
h = heatmap(time, postmile, speed);
댓글 수: 3
Walter Roberson
2021년 3월 27일
time = T{2:end,1};
postmile = T{1,2:end};
speed = T{2:end,2:end}.';
h = heatmap(time, postmile, speed);
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!