How to import information from an excel file with many spreadsheets
1 次查看(过去 30 天)
显示 更早的评论
Hi, I am very new using Matlab I need to do the next:
- Import two columns from a multiple datasheets from one excel file, i need a specific range A2:B7804
- To plot this information, there are to variables Time and signal
- To save these plots
There are 24 sheets in each excel file, I read about to use readtable and xlsread but I tried to do a loop to import data but I can't understand how to save the information from each sheet, and then plot, I can imagine that I have to save each couple of columns in a group of tables but I don't know how to do it
Thanks for your help, It is very important for me this blow my mind :(
num_sheets = 24;
for i=1:num_sheets
data = readtable('CONSOLIDADO M50.xlsx', 'Sheet', i,'Range','A2:B7804');
end
回答(1 个)
Star Strider
2022-4-29
Try something like this —
num_sheets = 24;
for i=1:num_sheets
data{i} = readtable('CONSOLIDADO M50.xlsx', 'Sheet', i,'Range','A2:B7804');
end
See the documentation section on Access Data in Cell Array for more information on how to work with them.
.
1 个评论
Star Strider
2022-4-29
The reference:
M = data{i}
should display the relevant information from that sheet of the Excel file.
You can then use the appropriate columns of ‘M’ to do the plot.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!