Warning while loading an anonymous function

9 visualizaciones (últimos 30 días)
HpW
HpW el 13 de Ag. de 2022
Comentada: HpW el 13 de Ag. de 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!

Respuesta aceptada

Walter Roberson
Walter Roberson el 13 de Ag. de 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.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by