Combine multiple matrix variables into a structure?
3 次查看(过去 30 天)
显示 更早的评论
I currently have 180 matrix variables (1336 x 4) that I would like to make into a structure to make it easier to work with. In the end I want to be able to plot all of this data in the same way on separate plots or subplots.
What is the best way to combine the matrices? I am able to create a structure using 'whos' and then add on a 'data' field of zeros to put the final data in but how would I transcribe all of the variable data into the structure? The variables are not concurrently named so I am struggling to get a for loop to work.
3 个评论
Walter Roberson
2018-9-4
The best approach would be to not get into this situation, to store the information in a structured manner instead of in separate variables.
采纳的回答
Stephen23
2018-9-4
编辑:Stephen23
2018-9-4
You do not say anything about how these variables get into the workspace, so I am going to a guess that they are all contained in one .mat file, in which case the answer to your question is trivially simple:
S = load(...)
If the data are saved/created in some other way, then you please tell us exactly how you got all of those variables into the workspace, and we will show you better methods for handling data.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!