Compatability of runtime engine with matlab gui application

10 views (last 30 days)
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
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?
  • 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.
Chris
Chris on 12 Aug 2025
Hello! Appreciate the confirmation. I had not installed in the same directory. I just installed R2024b to see if that was the problem. Nope. The difficulties are an error best seen in the attached picture. I close all figs, clear all variables, and clear the command line. I add a folder to the path. I define a string variable. Running the script causes and Error using eval due to an Undefined function 'sorkspacefunc' for input arguments of type 'struct'. I cannot see what could be wrong here. but it does make it so the Matlab gui has to be closed and reopened. Any thoughts appreciated. Thank you.

Sign in to comment.

Accepted Answer

Steven Lord
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!
  1 Comment
Chris
Chris on 12 Aug 2025
Yes! That was it. Meant to have addpath. Using path sent everything over the cliff in odd ways. Thank you.

Sign in to comment.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!