Unrecognized function or variable 'typeof'

6 次查看(过去 30 天)
I am getting a very weird error every once in a while, and it happens so randomly that I can't even really see a pattern to understand what causes this. I have a main code for a project which calls functions from different directories. I open Matlab and add the folders that my main code needs into my Matlab path, but sometimes Matlab gives an error sound after doing this (although the directory is actually added to the path) and then it gives the error in the screenshot I shared. After this, MATLAB practically becomes non-funtional: Command window works but I can't run any other m files, or I can't remove the folders I added from the path so I have to re-open MATLAB. I don't have any ways to reproduce this error because even if I don't make any changes, it sometimes starts working back after a couple of days.
Some of the folders are far away from the main code and I realized that sometimes it works to add these helper folders into the same directory my main m file lies in. I can do this if there is no solution to this but obviously this will require copying and pasting these folders any time I want to work on a new project.
I have seen one question about this unrecognized 'typeof' error but it didn't quite help my situation.
Has anyone ever encountered a similar error when trying to add directories into their paths? Any help is appreciated.
Thanks.

采纳的回答

Steven Lord
Steven Lord 2020-9-13
You have downloaded or written an isa function that is shadowing (taking precedence over) the built-in isa function. Locate that shadowing isa.m and rename or remove the isa.m files that are not in a directory under matlabroot. Line 2 of that isa.m calls typeof which is not a function included in MATLAB.
which -all isa
  1 个评论
Hazar Benan Unal
Hazar Benan Unal 2020-9-13
Yes, problem solved! It turns out one of the toolboxes I installed has its own isa.m file and it was shadowing the built-in isa.m as you said. I renamed it and error is gone. Thank you very much.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by