- Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error.
- Does it do something different than what you expected? If so, what did it do and what did you expect it to do?
- Did MATLAB crash? If so please send the crash log file (with a description of what you were running or doing in MATLAB when the crash occured) to Technical Support so we can investigate.
Compatability of runtime engine with matlab gui application
10 views (last 30 days)
Show older comments
To Whom It May Concern;
I have Matlab 2023b installed on my Windows 11 laptop. I recentely installed the Matlab 2024b runtime engine in order to run a program someone else developed. Soe the 2023b version of Matlab use the runtime engine? I ask because of difficulties I am having running a piece of code.
2 Comments
Steven Lord
on 12 Aug 2025
It shouldn't, assuming you didn't install the runtime engine in the same folder as the installation of MATLAB (and if you had, MATLAB probably wouldn't have started at all.)
What does "difficulties" mean in this context?
Accepted Answer
Steven Lord
on 12 Aug 2025
In general, you probably don't want to use the path function with an input argument.[*] That changes the MATLAB search path to whatever the input is. So the only directory on your path after that call is your COMMON_FUNCTIONS directory.
The function you probably intended to call was addpath, which adds a directory to the existing search path.
To fix the problem, you could call restoredefaultpath or restart MATLAB (assuming you haven't saved the now much truncated search path to the pathdef file using savepath or the Set Path dialog on the Home tab of the Toolstrip. In that case, call restoredefaultpath.)
As a side note, I strongly recommend breaking the habit of calling "close all, clear all, clc" at the start of your scripts (and especially at the start of functions.) If you ever want to run this script twice and compare the results of the runs, the second running of the script will have blown away all the figures, variables, and Command Window display from the first run that you'd like to use for your comparison. They're big hammers, and so if you call them you should call them deliberately not automatically. [Inside a function clear all is particularly bad; did you call your function with input arguments? They're gone.]
[*] Two exceptions are if you need to retrieve the path by calling it with an output argument, modify that variable by putting something in a particular place in the list, then set the path to the modified variable. Something along the lines of:
oldpath = path;
newpath = someOperationsToModifyThePath(oldpath);
path(newpath);
Another exception would be to temporarily add a directory to the path. In a test file I'd use an matlab.unittest.fixtures.PathFixture Class object to automatically handle resetting the path to its previous state; in a regular function I'd use something like:
oldpath = path;
restorePath = onCleanup(@() path(oldpath))
% Now modify the path with addpath, etc.
The onCleanup object will run that function handle when it gets destroyed, meaning whenever the function I'm running exits (either successfully or with an error) it'll get restored. If MATLAB crashes that function handle probably won't run, but in that case I'm not going to be running any more code in that MATLAB session anyway!
More Answers (0)
See Also
Categories
Find more on Introduction to Installation and Licensing 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!