After I resolved some issues on my own machine with pulling and running updated files from the github and confirming the correct working folder/directory combo, the last fix I needed to do to make the demo run was to replace the use of the function summary_stats with some direct assignment of variables in the evaluate_time_fit function. I think summary_stats is not included in my MATLAB 2019 software/plugins. Now its running great, and I have been fitting to the force for my experimental traces and made a few additional edits to also fit the M1 state. Thanks!
Original error:
Error using evaluate_time_fit (line 18)
An UndefinedFunction error was thrown on the workers for 'summary_stats'. This might be
because the file containing 'summary_stats' is not accessible on the workers. Use
addAttachedFiles(pool, files) to specify the required files to be attached. For more
information see the documentation for 'parallel.Pool/addAttachedFiles'.
Error in evaluate_single_trial (line 26)
[e, y_attempt] = evaluate_time_fit(sim_output,p.target_data, ...
Error in fit_worker (line 53)
parfor i=1:numel(opt_structure.job)
Error in fit_controller/run_trial (line 40)
fit_worker(p_vector,opt_structure);
Error in fit_controller>@(x)run_trial(x,opt_structure) (line 22)
fh = @(x)run_trial(x, opt_structure);
Error in fminsearch (line 200)
fv(:,1) = funfcn(x,varargin{:});
Error in fit_controller (line 33)
fminsearch(fh, p_vector);
Error in P710R_fit_time_domain_2 (line 14)
fit_controller(opt_structure.MyoSim_optimization);
Caused by:
Undefined function 'summary_stats' for input arguments of type 'double'.
My fix:
evaluate_time_fit
% Sum of squares error for last part of simulation
target_stats.max = max(target_data);
target_stats.min = min(target_data);
target_stats.n = length(target_data);% = summary_stats(target_data);
After I resolved some issues on my own machine with pulling and running updated files from the github and confirming the correct working folder/directory combo, the last fix I needed to do to make the demo run was to replace the use of the function summary_stats with some direct assignment of variables in the evaluate_time_fit function. I think summary_stats is not included in my MATLAB 2019 software/plugins. Now its running great, and I have been fitting to the force for my experimental traces and made a few additional edits to also fit the M1 state. Thanks!
Original error:
Error using evaluate_time_fit (line 18)
An UndefinedFunction error was thrown on the workers for 'summary_stats'. This might be
because the file containing 'summary_stats' is not accessible on the workers. Use
addAttachedFiles(pool, files) to specify the required files to be attached. For more
information see the documentation for 'parallel.Pool/addAttachedFiles'.
Error in evaluate_single_trial (line 26)
[e, y_attempt] = evaluate_time_fit(sim_output,p.target_data, ...
Error in fit_worker (line 53)
parfor i=1:numel(opt_structure.job)
Error in fit_controller/run_trial (line 40)
fit_worker(p_vector,opt_structure);
Error in fit_controller>@(x)run_trial(x,opt_structure) (line 22)
fh = @(x)run_trial(x, opt_structure);
Error in fminsearch (line 200)
fv(:,1) = funfcn(x,varargin{:});
Error in fit_controller (line 33)
fminsearch(fh, p_vector);
Error in P710R_fit_time_domain_2 (line 14)
fit_controller(opt_structure.MyoSim_optimization);
Caused by:
Undefined function 'summary_stats' for input arguments of type 'double'.
My fix:
evaluate_time_fit
% Sum of squares error for last part of simulation
target_stats.max = max(target_data);
target_stats.min = min(target_data);
target_stats.n = length(target_data);% = summary_stats(target_data);