Undefined function 'close' for input arguments of type 'char' when running app.
Mostrar comentarios más antiguos
I have a p-code Calc.p and a file Settings.m
The p-file executes the following steps:
- open window to select the folder with data files.
- load the data files.
- call the function Settings to set analysis paramters based on the data file name.
- perform data analysis.
- export results to datafiles and figures.
This p-code runs fine in my MATLAB environment without any error messages or warnings.
Next, I wrapped the p-code in the following, very simple, matlab code Embedded_P_code.m that just calls the p-code
% ==================
% Embedded .p code
Calc.p
% ==================
Next Embedded_p_code.m was compiled to an executable with the files Calc.p and Setting.m added to the folder 'Files required for your application to run'. No errors or warnings were shown during compilation.
Unfortunately, when running the Embedded_p_code.exe I get the following error message:
Undefined function 'close' for input arguments of type 'char'.
Question:
Why does this error pops up when running the executable and not when running the p-code in the Matlab environment?
My only wild guess is that the compiler can not analyze p-files for dependent files, i.e. dependent files have to be added manually to the folder 'Files required for your application to run'. However, apart from Setting.m, there are no other files required to run the p-file.
I know that the p-file uses the Signal Processing and Image Processing toolboxes which add-ons are both installed. I asume, I do not have to add these manually to the folder 'Files required for your application to run' during compilation.
Thanks for any comment, suggestion, answers or ideas.
Respuestas (2)
Walter Roberson
el 17 de Ag. de 2023
0 votos
As an experiment it might be interesting to add something similar to
function varargout = close(varargin)
if ischar(varargin{1})
this is the case being reported
display appropriate information
else
[varargout{:}] = builtin('close', varargin{:} );
end
I certainly do not know, but I am wondering if somewhere the code is doing
close('all')
5 comentarios
dpb
el 17 de Ag. de 2023
Well, it's doubly tough to conjecture when can't see the code to even see where a line calling close is...obviously it would be helpful if OP would post the m-file, but I suppose he turned into p-file because thinks it's sensitive.
I wonder if by any chance a compiled app would generate an error that doesn't at command line if called close() on an non-existent figure or with the 'all' argument with none open...
But without anything at all to look at, don't see much hope in anybody here being able to help...
Bas van der Vorst
el 21 de Ag. de 2023
dpb
el 21 de Ag. de 2023
If you're not the one compiling the app, then the setup isn't the same between systems and sounds as though the supplier didn't do a good job of ensuring the differences between running in the MATLAB environment and in a compiled app are handled correctly and that his code isn't dependent upon his particular setup.
Again, will be nearly impossible for anybody here to be able to do much of anything with it as a black hold object.
Walter Roberson
el 21 de Ag. de 2023
If so then if they add the comment
%#function mat2gray
then mat2gray should get compiled into the executable.
Bas van der Vorst
el 21 de Ag. de 2023
Bas van der Vorst
el 21 de Ag. de 2023
Editada: Bas van der Vorst
el 21 de Ag. de 2023
0 votos
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!