Warning while loading an anonymous function

6 次查看(过去 30 天)
Hello
I have a .mat file named DATA.mat that contains some data and an anonymous function 'standardizeFun':
DATA.mat contains the following
Z1 = 1x8479 cell
Z2 = 1x8479 cell
standardizeFun
standardizeFun =
function_handle with value:
@(x)(x-mean(cell2mat(Z1),2))./mean(cell2mat(Z2),2)
when I load DATA.mat i get the following error:
load('DATA.mat')
Warning: Could not find appropriate function on path loading function handle H:\old_directory\stdz.m>@(x)(x-mean(cell2mat(Z1),2))./mean(cell2mat(Z2),2)
However, the standardizeFun function works completely fine despite the error.
I have no idea why it is referencing H:\old_directory\stdz.m - this was an old directory that should have no relationship to the current project and I don't see any place where this string should even be attached to the DATA.mat file
I thought that perhaps something was attached to the standardizeFun structure, but doesnt look that that directoryfile shows up there either
>> f = functions(standardizeFun)
struct with fields:
function: '@(x)(x-mean(cell2mat(Z1),2))./mean(cell2mat(Z2),2)'
type: 'anonymous'
file: ''
workspace: {[1×1 struct]}
within_file_path: ''
f.workspace{1}
ans =
struct with fields:
Z1: {1×8479 cell}
Z2: {1×8479 cell}
Can someone please explain why this error is showing up and what I can do to fix it (or if I need to do anything since it seems to be working fine despite the error?)
thanks!

采纳的回答

Walter Roberson
Walter Roberson 2022-8-13
You are calling functions() on the version of the function loaded from the file, rather than looking at what is stored in the mat file.
Resave the file to fix the problem.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by