Error message when attempting to plot selected area from a XLSX file: " Specify one or two table subscripts after the table."
62 次查看(过去 30 天)
显示 更早的评论
Hi, I try to plot a defined area of data in an XLSX file, the area is defined from by the columns C11-C6796 and D11-D6796
So I define the upper left corner by C11 and the lower right corner by D6796. Which I then want to plot, but with
T=readtable('tempDataTrollhFlygpl.xlsx',Range="C11:D6796",ReadVariableNames=false);
plot(T)
xlabel('Year');
ylabel('Temperature');
I get
"Error using plot
Invalid number of input arguments. Specify one or two table subscripts after the table.
Error in uppgift32 (line 2)"
So the error is in the T part of the plot command? I used the MATLAB documentation to define the specific area of data to go in a 2D plot, but why does not that work?
Thanks
0 个评论
采纳的回答
Cris LaPierre
2024-1-30
What variables in T do you wnat to plot? Since T is a table, you must use one of these syntaxes
4 个评论
Cris LaPierre
2024-1-30
Your data is being read in as text. Here's another option that demontrates the table syntax.
T=readtable('tempDataTrollhFlygpl.xlsx',Range="C11:D6796",ReadVariableNames=false,TextType="string");
T = convertvars(T,"Var2","double")
plot(T,"Var1","Var2")
xlabel('Year');
ylabel('Temperature');
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!