Populating a spreadsheet - dlmwrite, '-append' and specifying rows and columns
12 views (last 30 days)
Show older comments
Commented: Mary on 26 Mar 2014
I'm trying to use a for loop to populate a spreadsheet with information from a struct, such that it pulls out each piece of information into a separate row.
My problem is arising when I try to use csvwrite - I can't append so it just gets overwritten. I switched to using dlmwrite but am now encountering another problem.
I originally tried this - but it got overwritten each time.
I tried adding append in - but then it takes it format differently and comes back with an error stating I have an invalid attribute.
Error using dlmwrite (line 118)
Invalid attribute tag: 1
Any thoughts on how I can format this so that I can still specify the row and column?
PS. I cant really use xlswrite as I dont know the row names - (it's going to be in the thousands of rows - so Its difficult to call A1324)- unless anyone knows a workaround
Joseph Cheng on 26 Mar 2014
The error is that you are missing 'roffset' and 'coffset' designators for the row and column. However that will still not do what you want. Will A, B, C, D be all the same length? The problem with using -append is that it'll append it to the bottom of the file, so you will not be able to get your [A B C D] columns aligned. If they are the same length i would write them all at once with a single dlmwrite.
More Answers (0)
Find more on Text Files 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!