Undefined function 'savetofile' for input arguments of type 'sym

2 views (last 30 days)
Hi all,
I'm using a co-author's program from a published paper and while running his code with different data, I ran into the following error message:
Error using runDLRsym (line 40)
The source code (C:\Users\nkhoz\Desktop\Wed10Aug\ReplicationFiles_Empirical\BenchmarkModel\PrepWald\runDLRsym.m) for the parfor-loop that is
trying to execute on the worker could not be found.
Error in RunPrep (line 6)
runDLRsym(nv, ng);
Caused by:
Undefined function 'savetofile' for input arguments of type 'sym'.
Error using remoteParallelFunction (line 84)
Worker unable to find file.
Undefined function 'savetofile' for input arguments of type 'sym'.
After I asked him about it, he ran the program and the he got the same error message back (this program used to work just fine). Neither of us has any idea. I was hoping someone would be kind enough to help me work this out? Apparently SaveToFIle was introduced in 2015, but I'm not aware/cannot find any info of it being replaced by something else. I do have the symbolic toolkit add on, so that's not the issue.
For the sake of clarity, here are the lines that Matlab isn't happy with. Line 40 is from this:
function runDLRsym(nv, ng)
...
...
...
...
for row = 1:nv
parfor col = 1:ng-1
name = sprintf('DLRsym%d%d',row,col);
varr = DLRsym(row,col);
savetofile(varr,name);
end
end
toc
Line 6 from the program that calls DLRsym is here:
tic
%parpool(4)
nv= 6;
ng = 3;
runDLRsym(nv, ng);
toc
getjacobDLR(nv, ng);
toc
%4000 seconds to run
  2 Comments
Benjamin Thompson
Benjamin Thompson on 15 Aug 2022
Maybe savetofile is a local function on your system and you are not pushing it to the parallel workers or your MATLAB path is not pushing to the parallel workers? You use parforOptions to add additional files to send to workers, and maybe the automatic dependency analyzer is missing that one.
Fede C 2018 London
Fede C 2018 London on 15 Aug 2022
Hi Benjamin, thanks for your message. I haven't written any parts of this program myself, so I'm a bit in the dark-do you mean that the author(s) had programmed their own function called savetofile and that is the bit that might be missing?

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 16 Aug 2022

More Answers (0)

Categories

Find more on Parallel for-Loops (parfor) in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!