when i tried run something from excel it shows error?
1 次查看(过去 30 天)
显示 更早的评论
%load('Ftr.mat'); %load first 1000 data
Data=xlsread('data.xlsx','Sheet1');
Ftrain= Data(1:1:990);
Ftest=Data(1:1:1000);
when i run this. i got this error.
>> Ftrain= Data(1:1:990)
Subscripting into a table using one subscript (as in t(i)) or three or more subscripts (as in t(i,j,k)) is
not supported. Always specify a row subscript and a variable subscript, as in t(rows,vars).
0 个评论
回答(1 个)
Walter Roberson
2020-12-1
Ftrain = Data(1:990, :);
Ftest = Data(991:1000, :);
Note that this will return the same datatype that Data is -- if Data is a table then Ftrain and Ftest will be tables as well.
Your code shows you using xlsread() but xlsread() can never return table objects. The first output of xlsread() is strictly numeric. You would have had to have used readtable() to get a table returned.
See also readmatrix()
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!