table editing and excel export
이전 댓글 표시
Hello,
I don't know Matlab well yet and can't get any further.
I get from an analysis of a Matlab program the results as a table, which I want to edit in Matlab and export to Excel.
Time Value1 Value2 ...
1.0 27832.2 129819.2 ....
... ...
After the first line, I would now like to insert 2 more lines. One line should contain the unit and the second line should contain a comment (2 of the test parameters).
In addition, a variable is to be added after each heading ( Value1 - Sample1, Value2 - Sample1...).
The table is then to be exported into an Excel table. The name should consist of the experiment data ( Sample1_date.xls). The two variables are read in at the beginning of the program.
Then a second Excel table is to be exported in which the data of the Value1-Value10 columns are converted with a conversion factor.
Can anyone help me?
Sorry for my bad english, I hope it's understandable.
댓글 수: 3
dpb
2019년 11월 20일
Look at writetable for starters...
dpb
2019년 11월 22일
Ayup. No can do that. MATLAB table variables are like regular variables--they must be consistent in type. The only way you can write numeric data together with non is to use a cell array to hold the content. That then will probably make using your resulting table difficult unless this is solely for display purposes.
Tell/Show us what you're really trying to accomplish as an end result and probably be able to get some better approaches.
답변 (1개)
Image Analyst
2019년 11월 22일
I suggest you add the units in the column headers themselves, like
variableNames = {'Time_[sec]', 'Value1_Sample1_[kg]'};
댓글 수: 1
dpb
2019년 11월 22일
There actually is a 'VariableUnits' property in the table object for exactly that purpose. As well as 'VariableDescriptions' and 'UserData' for additional identification.
It's unfortunate that the command window display of a table doesn't have a way to cause these to show up, though, you have to query their values (at least thru R2017b which is latest I've gotten around to installing here).
카테고리
도움말 센터 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!