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

조회 수: 1 (최근 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에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by