Importing data from Excel to Matlab problem
2 次查看(过去 30 天)
显示 更早的评论
Hi guys, I'm having a problem important datas from Excel. I used to import ranges because I found it easier, but now I need to gather a whole sheet from Excel. When I use xlsread, The import is working but the first row of my sheet, which contains the name of my variables disappears. I would like to keep em after important. Thank you in advance.
0 个评论
回答(3 个)
Evan
2013-7-2
编辑:Evan
2013-7-2
This has to do with the output arguments when you call xlsread. With only one output argument, only numerical data is read in into separate arrays. With two arguments, numerical and text is read in. If you want to pull the data in all as a single cell array with different datatypes, specify a third output argument, like so:
[num,txt,raw] = xlsread(___);
And if you don't want the separate numerical and text arrays:
[~,~,raw] = xlsread(___);
0 个评论
Simon
2013-7-2
1 个评论
Evan
2013-7-3
编辑:Evan
2013-7-3
If the example code you posted is the one you're using, it doesn't look like you're getting raw output. You need to specify your call to xlsread like this:
[~, ~, Example] = xlsread('filename','Database','CD5:CD530');
That should read your excel data into a cell matrix that is essentially a cell-for-cell copy of your excel spreadsheet, no matter the format or datatypes of your different columns.
Apologies if I'm misunderstanding your problem.
Bheki SIFUBA
2019-10-19
I have 3 different data types in one cell (column), one is text and the other two are numbers, how can I import in 3 different rows?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!