Undefined function 'syms' for input arguments of type 'char', what can I do?
49 views (last 30 days)
Show older comments
marvellous
on 21 Aug 2024 at 6:16
Commented: marvellous
on 22 Aug 2024 at 3:11
In matlabR2023b, I packaged two m files into an exe file, in need of solving equations, I used the function 'syms' in these two m files. There was no problem running these m files before. However, running the generated exe file report errors. The error code is as follows. What is the reason for this? What should I do? Could you please give me some advice? Thank you!
Error code: Undefined function 'syms' for input arguments of type 'char'.
'syms' was excluded from packaging for the MATLAB Runtime environment according to the MATLAB compiler license. Have the application owner either resolve the file or function from the code, or use the MATLAB function "isdeployed" to ensure the function is not invoked in the deployed component.
Connect the application owner for more details.
Error in => ceshi1.m at line 14
3 Comments
Walter Roberson
on 21 Aug 2024 at 6:46
Absolutely nothing from the Symbolic Toolbox can be compiled or have code generated for it.
You will need to work around it using the methods linked to by @Stephen23
Accepted Answer
Uday
on 21 Aug 2024 at 7:04
Hi Marvellous,
The error message "Undefined function 'syms' for input arguments of type 'char'" indicates that the "syms" function is not available in the compiled executable. This typically happens because "syms" is part of the Symbolic Math Toolbox, which is not supported in the MATLAB Runtime environment used for deployed applications.
The following answer gives more direct way doing this: https://www.mathworks.com/matlabcentral/answers/1982214-how-to-deploy-when-using-syms-and-solve-with-function-input-arguments-to-consist-the-equation-in, you can go through the steps mentioned.
You can try the following ways as well:
- If possible, perform all symbolic computations in MATLAB before deploying your application. Save the results as numeric values or functions that can be used in the compiled executable.
- Use the "isdeployed" function to conditionally execute code. This way, you can ensure that symbolic computations are only performed in the MATLAB environment and not in the compiled application. For example:
if ~isdeployed
syms x
% Perform symbolic computations
else
% Use precomputed results or alternative logic
end
Alternative Methods: Consider using numerical solvers or other MATLAB functions that are supported in the MATLAB Runtime environment for the computations you need.
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox 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!