Can not create MATLAB string without MATLAB runtime being initialized.
2 次查看(过去 30 天)
显示 更早的评论
I create a .NET assembly using a function written in MATLAB. When I want to create a MATLAB String using MWStringArray Class, it generate a exception "Can not create MATLAB string without MATLAB runtime being initialized", but using MWCharArray Class is successful.
采纳的回答
Hitesh
2025-2-3
Hi Chuguang,
The error indicates that the environment variables for MATLAB are not correctly set. This typically involves ensuring that the MATLAB executable is in your system's PATH.
- Open the Control Panel and go to System > Advanced system settings > Environment Variables.
- Check if the MATLAB installation path is included in the PATH variable.
Ensure that you are using MATLAB functions correctly in your scripts. If you are using this function "matlab.lang.makeValidName", make sure it is supported by MATLAB version.

If the issue still persist, refer to the following MATLAB Answer for license related issue with MATLAB Run time:
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 COM Component Integration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!