Can MATLAB save the Profiler results table (Function Name, Calls, etc.) to a text file or a spreadsheet?
9 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Ive J
on 1 Mar 2022
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
0 Comments
More Answers (2)
Sulaymon Eshkabilov
on 21 Feb 2022
Edited: Sulaymon Eshkabilov
on 21 Feb 2022
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')
Sulaymon Eshkabilov
on 21 Feb 2022
You can try this fcn - extracthmltext() to extract the data from html formatted file:
https://www.mathworks.com/help/textanalytics/ref/htmltree.extracthtmltext.html
See Also
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!