Reputation: 3821
I'm new to Matlab compiler. I've got a simple GUI with a button that when it's pressed it calls a m-function (myfunction.m). This function simply return a number that is then showed with a message box. If I compile as:
mcc -m myfile.m
everything works fine. But if I add to myfunction.m this code:
load mydata.mat
The compiled file doesn't work, if I click the button then the message box doesn't appear. How should I treat load command when I compile with matlab?
Upvotes: 1
Views: 1642
Reputation: 4732
Inside Matlab I often locate the path with which
:
tmp = which('myfile');
t2 = fileparts(tmp);
data_with_path = fullfile(t2,'mydata.mat');
Not sure if it works when compiled tough.
Upvotes: 0
Reputation: 21563
Try this:
wd = cd % Gets the current directory
load([wd '\filename'])
Upvotes: 1