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

2 次查看(过去 30 天)
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 个评论
Benjamin Thompson
Benjamin Thompson 2022-8-15
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 2022-8-15
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?

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2022-8-16

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by