Error while trying to save profiler

Hi,
I'm using the following code to save the profiler
profsave(profile('info'),strcat('C:\Users\Some Name\Desktop\', DateStarted, '\Profile_Result'));
The folder strcat('C:\Users\Some Name\Desktop\', DateStarted, '\Profile_Result') exists and the profiler starts saving HTML files with names starting from "file0", "file1" etc in the above folder but then it abruptly stops after a couple of HTML files and then displays the following error:
Subscript indices must either be real positive integers or logicals.
Error in profview>makefilepage (line 1245)
canRunList =
find(linelist(startLine:endLine)==runnableLines(startLine:endLine)) +
startLine - 1;
Error in profview (line 70)
s = makefilepage(profileInfo,idx, busyLineSortKeyStr2Num(busyLineSortKey));
Error in profsave (line 42)
str = profview(n,profInfo);
What could be the issue?
Thanks
Hari

 Respuesta aceptada

Sudhanshu Bhatt
Sudhanshu Bhatt el 28 de Oct. de 2015

1 voto

Hi Hari,
This behavior was seen in MATLAB R2013b in the way PROFSAVE handles p-coded functions to which a plain comment M-File exists.
To workaround the issue, localize the M-File and rename or remove it before running PROFSAVE.
In the case you do not know which M-File causes the error do the following:
1) Set a conditional breakpoint in line 1118 of the file profview.m ( the line would be: runnableLines = runnableLines .* lineMask;). Set the condition to be startLine == 0.
2) Run PROFSAVE and wait until you reach the breakpoint. Now, you can obtain the function name which causes the error be looking at strc(fcnIdx) variable.
3) Locate the file by using WHICH command and rename the M-file.
If this still does not resolve your issue, you can create a Technical Support Request by clicking on the link below:
Thanks
Sudhanshu Bhatt

10 comentarios

Hari
Hari el 2 de Nov. de 2015
Hi,
Thanks for the response. I have no p-codes in my workflow. All are regular *.m code files
But it seems that some of the functions that I use from matlab are itself *.p. I went through the steps you outlined and the break is happening for
C:\Program Files\MATLAB\R2015a\toolbox\symbolic\symbolic\symengine.p
Frankly I dont need to save the profiler part of "symengine.p". I'm primarily interested only in profiling the parts based on my own codes
So what could I do to overcome this error? I dont understand what you mean by "To workaround the issue, localize the M-File and rename or remove it before running PROFSAVE."
Thanks
Hari
For example after having located C:\Program Files\MATLAB\R2015a\toolbox\symbolic\symbolic\symengine.p as the problem,
rename the corresponding .m to something that MATLAB does not pay attention to
movefile('C:\Program Files\MATLAB\R2015a\toolbox\symbolic\symbolic\symengine.m', 'C:\Program Files\MATLAB\R2015a\toolbox\symbolic\symbolic\symengine.m_help');
Hari
Hari el 2 de Nov. de 2015
Thanks for the response Walter.
Can you kindly indicate where the "movefile" code needs to go in. Is it
a) within "PROFVIEW FUNCTION" Or
b) within "PROFSAVE FUNCTION" Or
c) Is this a one-time execution to be submitted in the "COMMAND WINDOW" Or
d) Is this a code inserted in my own code/workflow just before I call the profsave command for saving profiler results?
I'm asking the above to understand if this is a one-time activity or not and also what if there are other "p-code" files native to matlab where the failure may occur:
1) My original codes/workflow runs on different machines so do I need to repeat the "movefile" process in every machine
2) Also within a single machine the same set of codes/workflow are run multiple times with different seed. I assume "movefile" is a one time fix for a specific machine
3) If there are other "p-code" files where the break happen, I guess then the process needs to be repeated with the argument for "movefile" appropriately changed
Also once the movefile changes the name of the extension from "symengine.p" (I believe u meant to write symengine.p as 1st argument instead of symengine.m?) to "symengine.m_help" would it not cause issues in future when I refer to symengine function?
I'm surprised MATHWORKS hasnt taken steps to hide this unnecessary complexity ("patchwork") from end users. Why Cant MW just implement (programmatically) the skipping of p-files from saving process and just issue a note/warning saying that p-files not saved.
Thanks
Hari
Walter Roberson
Walter Roberson el 2 de Nov. de 2015
This is one time per file (on each system)
Do not move the .p file: move the .m file . The .p file has the real code (in encoded format) and the .m file contains only documentation.
This was a bug that is, I gather, thought to have already been fixed. The bug does not appear to have an externally-visible ID. You should ask technical support for assistance and reference this discussion.
Hari
Hari el 2 de Nov. de 2015
Thanks for the getting back around "one time/file/system" and "move only the *.m dummy documentation corresponding to actual *.p".
So I gather from this that I need to use option c) which is "COMMAND WINDOW" for this "movefile" code. Right?
Btw, I did raise a technical request (yesterday) based on the link provided by Sudhanshu and also referenced this open discussion.
Walter Roberson
Walter Roberson el 2 de Nov. de 2015
Yes, command window unless you want to edit the code in profview.m .
Hari
Hari el 3 de Nov. de 2015
Thanks for the clarification Walter.
Any ideas on why I get an access denied error when I issue movefile command. I'm the sole owner/admin of this system (Win 8 Pro).
Restarting Matlab does not work. I can post a seperate thread if it is considered as a new issue
Walter Roberson
Walter Roberson el 3 de Nov. de 2015
Starting some time in Windows Vista (I think it was), files that are stored under the standard executable directory are protected against user write access, as a security measure. You will need to run as Administrator to move / delete / rename them.
Hari
Hari el 6 de Nov. de 2015
For anybody else encountering this: Matlab Tech support confirmed that they were able to reproduce the problem in 2015a and it no longer appears in 2015b.
Thanks to Sudhanshu/Walter for providing the solution/steps.
Collin Spencer
Collin Spencer el 30 de Ag. de 2023
This error is present in R2021a.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Debugging and Analysis en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 22 de Oct. de 2015

Comentada:

el 30 de Ag. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by