Jiro's pick this week is ANY2CSV by Felix Zoergiebel.
I use structures quite often. It allows me to store heterogeneous information in one variable, and I can have structures within structures as well. Sometimes, I go crazy and make many levels of hierarchy to organize my information.
Let's take a look at this data.
load data
whosName Size Bytes Class Attributes a 4x1 2704 struct
This is a structure that contains information from a series of stress tests. I can dig into the structure to see its contents...
a(1)
ans =
TestName: 'Stress Test One'
Condition: 'fast'
Test: [2x1 struct]
a(1).Test(1)
ans =
Date: 'May 3'
Score: 89
But sometimes, I just want to view everything at once. ANY2CSV allows you to do just that. It flattens the structure and either displays it on the screen or saves it as a CSV file.
any2csv(a, ',', 0, 'a.csv');
Now, I have a summary of the data stored in the structure.
Very nice! I also want to thank Felix for his quick response to my enhancement request. I asked him whether the fields of the structure could be displayed vertically, rather than horizontally, and he updated the submission in a timely manner.
Comments?
Data visualizations don't always come in the form of graphs. We'd love to hear about other interesting ways of viewing information. Tell us about it here.
Get
the MATLAB code
Published with MATLAB® 7.7



Hi,
I have a question for you guys. i ll like to program a simple monte carlo simulation in matlab exclusively showing hardening of a beam. i.e A beam of light incident on a slab of water. To compare the incident and the transmitted spectra to see the effect of hhardening. Can some one help me out there with the matlab codes. Not c or c++
Peterslove,
I think this is off-topic for this blog (unless you were mistaking MATLAB structures with mechanical structures).
You should post this question on the CSSM newsgroup, but you may need to rephrase your question a bit. You will have a better chance of getting a response when you ask questions on specific MATLAB tasks, rather than a request for MATLAB code to solve a general problem.