I have a string and want to check if in the workspace exist any variable with the same name. In the workspace I have also many structures M.N.O M.N.N M.N.M etc. I can only check if there exist a variable with the name M. How to go deeper into this structure?
I tried:
exist('M.N')
YesNo = any(strcmp(who,'M.N.O'))
evalin('base','exist(''M.N.O'',''var'')')
all give me the same problem so I am stuck.
One option: write a recursive function to expand structures down to their leaf fields, appending the fields to a list.
(untested, conceptual code – probably won’t work quite right as is)
Then you can use the
any(strcmp(who,'M.N.O'))check you already came up with.