作者:打个的故事 | 来源:互联网 | 2023-05-18 17:14
ThereadtablefunctioninMatlabforreadinganMS-Excelspreadsheetisnotgivingmethelastcolum
The readtable
function in Matlab for reading an MS-Excel spreadsheet is not giving me the last column. Why?
Matlab中用于读取MS-Excel电子表格的可读函数没有给我最后一栏。为什么?
How can I fix this?
我怎样才能解决这个问题?
My code:
function assetslist = loadAssets()
xlFileDetails = 'mypath';
xlsheet = 'mysheet';
result = readtable(xlFileDetails,'Sheet',xlsheet,...
'ReadRowNames',true,'ReadVariableNames',true);
result(:,end)=[]; % append empty list in case no data
assetslist = result;
end
Sample data from my excel file is:
我的excel文件中的示例数据是:
Num Ticker IQIndex IBIndex UseIB IbType IbCur IbXch 1 SPX Index SPX.XO 0
2 CCMP Index COMPX.X 0
3 RTY Index RUT.X RUT 1 IND USD RUSSEL
Num Ticker IQIndex IBIndex UseIB IbType IbCur IbXch 1 SPX Index SPX.XO 0 2 CCMP Index COMPX.X 0 3 RTY Index RUT.X RUT 1 IND USD RUSSEL
But the result of the call gives me data with the last column missing.
但是调用的结果给了我最后一列遗漏的数据。
Num Ticker IQIndex IBIndex UseIB IbType IbCur 1 SPX Index SPX.XO 0
2 CCMP Index COMPX.X 0
3 RTY Index RUT.X RUT 1 IND USD
Num Ticker IQIndex IBIndex UseIB IbType IbCur 1 SPX Index SPX.XO 0 2 CCMP Index COMPX.X 0 3 RTY Index RUT.X RUT 1 IND USD
(My real data has 11 columns and only 10 are retrieved...)
(我的真实数据有11列,只有10列被检索...)
I'm using Matlab R2017b.
我正在使用Matlab R2017b。
1 个解决方案