Extracting Data in Excel With Groups into Matlab
5 views (last 30 days)
Show older comments
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 Comments
Dyuman Joshi
on 8 Aug 2023
What is your data? Attach the excel file via the paperclip button.
How exactly do you want to group them?
Answers (1)
Katy Weihrich
on 4 Aug 2023
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.
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!