Warning while loading an anonymous function

6 vues (au cours des 30 derniers jours)
HpW
HpW le 13 Août 2022
Commenté : HpW le 13 Août 2022
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!

Réponse acceptée

Walter Roberson
Walter Roberson le 13 Août 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.
  1 commentaire
HpW
HpW le 13 Août 2022
thanks! that worked.
appreciate the help

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by