With the following code:
bob = struct() bob.joe = 1 bob.sam = '4' bob.bill = [6:10] bob.jim = struct('a',1,'b','q') writetable(struct2table(bob))
I get the following output
joe,sam,bill_1,bill_2,bill_3,bill_4,bill_5,jim 1,4,6,7,8,9,10,
So the structure entry for 'jim' is just blank.
If I turn jim into a table
bob.jim = struct2table(bob.jim) writetable(struct2table(bob))
The output now has the _1 and _2 for jim, but they are blank
joe,sam,bill_1,bill_2,bill_3,bill_4,bill_5,jim_1,jim_2 1,4,6,7,8,9,10,,
So how do I get writetable to deal with this? Preferably I would want the header to come out
joe,sam,bill_1,bill_2,bill_3,bill_4,bill_5,jim.a,jim.b 1 ,4 ,6 ,7 , 8 ,9 ,10 ,1 ,q
Also, if I am not writing to a spreadsheet, I would liek the ability to not expand arrays, so it would look like
joe,sam, bill, jim.a,jim.b 1 ,4 ,[6,7,8,9,10] ,1 ,q
Best Answer