Dear readers,
I have a number of questions regarding the Matlab program I am trying to deploy as a standalone Windows application. The program uses a single (but crucial) 'parfor' loop. (I should point out that the same code using just the simple 'for' loop works as intended.)
1.) From within the parfor loop, I am trying to display some information for the user. At the moment I am using the 'disp' function, e.g.:
parfor i = 1:10
...
disp(['The index of this iteration is: ', num2str(i)])
...
end
This block of code works as intended when I run it from within Matlab. However, when I compile the application and try to run it from Command Prompt, the program doesn't display the required data anymore. What seems to be the problem? Are there any other functions that could help me achieve the required result (i.e. displaying lines of text for the user)?
2.) For a number of variables, Code Analyzer gives me the following error (the program still works, but the variables are underlined in red):
"The temporary variable 'x' uses a value set outside of the PARFOR loop."
I know that for declaring the variable 'x', I am combining some data defined before the parfor loop and some data from within the loop (typically the iteration index). But what seems to be the problem?
3.) When building the deployed .exe file, I get the following warnings:
"The temporary variable 'y' will be cleared at the beginning of each
iteration of the parfor loop. Any value assigned to it before the loop will be lost."
I am well aware of this and it is OK with me, however, I don't know how to disable the warning. I tried using the warning('off, 'all'), but the warnings persist. What especially bothers me is the fact that these warnings are also displayed each time that I run the deployed application from Command Prompt.
4.) As a final question, I noticed that there is a huge difference in file size of the deployed application when I'm using the parfor loop compared to the case when I'm instead using a simple for loop. The application with the parfor loop is well over 8 MB in size, whereas the application with the for loop is only 400 kB. I guess that trying to compile the code for using parallel processing takes many more lines, but I'm interested in hearing more about this.
Thank you very much in advance for all the help!
5 Comments
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/58720-deployed-applications-display-from-within-a-parfor-loop-and-some-other-questions#comment_122431
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/58720-deployed-applications-display-from-within-a-parfor-loop-and-some-other-questions#comment_122431
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/58720-deployed-applications-display-from-within-a-parfor-loop-and-some-other-questions#comment_122620
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/58720-deployed-applications-display-from-within-a-parfor-loop-and-some-other-questions#comment_122620
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/58720-deployed-applications-display-from-within-a-parfor-loop-and-some-other-questions#comment_122643
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/58720-deployed-applications-display-from-within-a-parfor-loop-and-some-other-questions#comment_122643
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/58720-deployed-applications-display-from-within-a-parfor-loop-and-some-other-questions#comment_122663
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/58720-deployed-applications-display-from-within-a-parfor-loop-and-some-other-questions#comment_122663
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/58720-deployed-applications-display-from-within-a-parfor-loop-and-some-other-questions#comment_122703
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/58720-deployed-applications-display-from-within-a-parfor-loop-and-some-other-questions#comment_122703
Sign in to comment.