Warning while loading an anonymous function

조회 수: 6 (최근 30일)
HpW
HpW 2022년 8월 13일
댓글: HpW 2022년 8월 13일
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.
  댓글 수: 1
HpW
HpW 2022년 8월 13일
thanks! that worked.
appreciate the help

댓글을 달려면 로그인하십시오.

추가 답변 (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