Extracting Data in Excel With Groups into Matlab
6 次查看(过去 30 天)
显示 更早的评论
Hello, I have a data in excel. Each row has a level from 1 to 10. Level shows subgroups. For example level 2 rows are subgroups of level 1 row. It goes like this. Is there a way that i can transfer it to matlab? It could be some cell in cell or a struct or is there anything else?
Also if there is a funtion that recognise levels, it could be very helpful
Example data:
Mass Level
23 1
10 2
2 3
8 2
13 2
10 3
3 3
4 个评论
Dyuman Joshi
2023-8-8
What is your data? Attach the excel file via the paperclip button.
How exactly do you want to group them?
回答(1 个)
Katy Weihrich
2023-8-4
Matlab has a option that automatically generates a code for reading excel files.
Go to Home --> Import Data (under Variable) --> open the excle file you want to load in --> select options that you need --> click on Inport Selection --> Generate Script
Matlap will open a untiteled scriped with a code that loads the data as you wish.
Tips for the selection of option:
- You can select the format of the output under Output Type (in Improted data)
- You can change the format of the variable (e.g. change Number to Categorical) below the variable name.
- In Range deselect the first row with the variable names (e.g. A2:B8 instead of A1:B8)
- if you read text files (e.g. .cvs) you need to ensure that the correct delimiter is selected and if you used excle in Germany you need to change the decimal seperator (under delimiter options) to comma instead of periode.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!