remove table header row

I have the attached table which I wish to
1) Remove the header row.
2) duplicate the second column and append to end, making a third column
3) convert resulting n x 3 structure to a text file.
I have tried converting the table to an array, and then duplicating the second column and appending it to the end making a gthord coliumn, without much luck
Any help greatly appreciated

 Accepted Answer

dpb
dpb on 1 May 2019
Edited: dpb on 1 May 2019
Should show your work when you've tried something that seems like should but doesn't...it's really quite a straightforward task--tables really do simplify a lot of machinations, particularly when have differing data types as here, for example, between datetime and double.
tst=AUDCAD1d(1:10,:); % again, only a little is as good as a whole lot...
tst.New=tst.Open; % make a new column with content of second
writetable(tst,'AUD.csv','WriteVariableNames',0) % write a csv file without header...
See what we gots...
>> type AUD.csv
20190501095950 ,0.94472,0.94472
20190501095955 ,0.94473,0.94473
20190501100000 ,0.9447,0.9447
20190501100005 ,0.94471,0.94471
20190501100010 ,0.94473,0.94473
20190501100015 ,0.94471,0.94471
20190501100020 ,0.9447,0.9447
20190501100025 ,0.94475,0.94475
20190501100030 ,0.94474,0.94474
20190501100035 ,0.94476,0.94476
>>
looks to satisfy requirements to me... :)
Excepting looks like there's an extra space on the time data...hmmm, let's see---
>> tst.Var1.Format
ans =
'yyyyMMddHHmmss '
>>
and indeed, there is. Might want to clean that up altho it may not hurt depending on the use of the file.

5 Comments

dpb
dpb on 2 May 2019
Having stumbled onto the other Q? after this, where you took the A preceding that literally in making an unneccessary tst variable mimicking my code, note that the ONLY purpose for it here is just as in that answer -- simply to have a small dataset for demo purposes so could show the results without having to subscript a subset -- 10 elements is just as good to illustrate syntax are 10,000 but the same syntax works on the whole array just as well as the subset, too...
Thank you. WIll rseolve extra space issue, if indeed it is an issue
dpb
dpb on 2 May 2019
All it would take is to go back to where you created the variable and get the output format string correct there...do it right the first time instead of having to clean up later.
Done. Thank you
dpb
dpb on 2 May 2019
Glad to help... :)

Sign in to comment.

More Answers (0)

Categories

Products

Tags

Asked:

on 1 May 2019

Commented:

dpb
on 2 May 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!