Cell/table Reformat
조회 수: 3 (최근 30일)
이전 댓글 표시
I have a very specific formatting issue. Right now, I have used the readtable command to load a csv file into the workspace. It looks something like this:
A={'Country', 'Prod1', 'Prod2';
'BE', '5', '8';
'NL', '15', '9';
'DE','13','18'};
However, I need it to look like this:
A={'Country','Product #', 'Amount';
'BE', '1', '5';
'BE', '2', '8';
'NL', '1', '15';
'NL', '2', '9'; ...}
Thanks for the help.
댓글 수: 0
채택된 답변
Pavithra Ashok Kumar
2016년 6월 15일
Hi
The "readtable" treats the entries in the first line of the file as variable names. So updating the first line of your .dat file should solve the issue. You can programmatically change the variable names by :
T.Properties.VariableNames{'Prod1'} = 'Product #';
Hope this helps.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!