table editing and excel export
6 次查看(过去 30 天)
显示 更早的评论
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-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).
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!