Warning while loading an anonymous function

9 views (last 30 days)
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!

Accepted Answer

Walter Roberson
Walter Roberson on 13 Aug 2022
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.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!