Export command prompt variables to excel sheet

3 ビュー (過去 30 日間)
Avantika Iyengar
Avantika Iyengar 2022 年 6 月 23 日
コメント済み: Avantika Iyengar 2022 年 6 月 24 日
I have a MATLAB code which calculates certain threshold values and other parameters of a signal. The signal is in the form of raw voltage values stored in a txt file. MATLAB imports the file using dlmread(). I want to test this code on many datasets and hence, want to collect the output from the workspace in an excel sheet. I want to append a preexisting excel template, everytime I run the code with a new .txt input data file. I have attached my template below. I am thinking of writing a python script and run it over MATLAB using pyrun, but is there any other effective function in MATLAB to do this job?
The values in this spreadsheet are entered manually by copy pasting the output from MATLAB workspace. Any solution to automate it?
  2 件のコメント
dpb
dpb 2022 年 6 月 23 日
編集済み: dpb 2022 年 6 月 23 日
See writecell, writematrix, etc., ...
Your best bet will be to build an array to write the column in one call; the MATLAB functions open/close Excel for each call so trying to write single cells in a tight loop is abadidea™.
Alternatively, and the approach I take on something somewhat similar is to read the template into a MATLAB table, modify the pieces of the table as needed, then simply rewrite the whole thing with writetable. The other functions above actually convert the input data to a table and call writetable with appropriate parameters, anyways.
Avantika Iyengar
Avantika Iyengar 2022 年 6 月 24 日
The second approach looks more potentiable. I'll try that out, thanks.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by