Can MATLAB save the Profiler results table (Function Name, Calls, etc.) to a text file or a spreadsheet?

2 ビュー (過去 30 日間)
Can MATLAB save the Profiler results table (Function Name, Calls, Total Time, Self Time) to a text file or a spreadsheet?
I need this to merge and compare Profiler results from different software versions.
  15 件のコメント
Ive J
Ive J 2022 年 3 月 1 日
Posted as an answer. Thanks!

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

採用された回答

Ive J
Ive J 2022 年 3 月 1 日
info = load("info.mat").info;
infotab = struct2table(info.FunctionTable);
infotabMain = infotab(:, ["FunctionName", "NumCalls", "TotalTime", "TotalRecursiveTime"]); % main table in profile viewer
infotabExc = cell(height(infotab), 1); % execution time per each subfunction
for i = 1:height(infotab)
infotabExc{i} = infotab.ExecutedLines{i};
infotabExc{i} = array2table(infotabExc{i}, ...
'VariableNames', {'Line Number', 'Calls', 'Total time(s)'});
end

その他の回答 (2 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2022 年 2 月 21 日
編集済み: Sulaymon Eshkabilov 2022 年 2 月 21 日
Yes, it can be done realtively easy with profsave(profile()), e.g.:
profile on
x = linspace(0, 1, 2e3);
y = sin(2*pi*t)+randn(size(x));
plot(x,y), grid on
profile off
% All html files are saved in your current directory and inside a folder called: MY_Profile_results
profsave(profile('info'),'MY_Profile_Results')
  1 件のコメント
Leigh Sneddon
Leigh Sneddon 2022 年 2 月 21 日
It seems that profsave creates an html file. I need a text or Excel file.

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


Sulaymon Eshkabilov
Sulaymon Eshkabilov 2022 年 2 月 21 日
You can try this fcn - extracthmltext() to extract the data from html formatted file:
https://www.mathworks.com/help/textanalytics/ref/htmltree.extracthtmltext.html
  1 件のコメント
Leigh Sneddon
Leigh Sneddon 2022 年 2 月 22 日
Sounds like a lot of text manipulation would be needed. I'll wait to see what Ive J comes up with. Thanks though!

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

カテゴリ

Find more on Tables in Help Center and File Exchange

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by