Assigning 0 if a variable is not present in mat file
3 views (last 30 days)
I am trying to assign zero to a variable which is not available in mat file. I am trying to make it work with following code which is not working as per my logic.
if isfield(data, variables(pr))==0
I am not able to make it work like I want to. So basically what I am trying to do is if suppose variable abc is not there in xyz.mat, I want to create abc of zeros(1,100) and if def is there in xyz.mat then I want to use it as it is.
Is this possible in matlab?