I have a huge number of signals/variables imported into workspace and I require only some selected variables along with values. Every variable is a double array. I have used string compare to get the selected variables but this gives only the names of them but not the values. I have used who which gives me only the names of the variable. Please guide me on how to get the values of each of these variables in a double array format.
load Test_2_4_1.mat; variables = who;%h = workspaceHandle;
%V = GetVariable(h,'variables','workspace');
%%to compare n parts of variable names (strings)
variable_list = variables;ans = strncmpi(variable_list,'PEC',3);ans_double = +ans;%k = 1;
i=1;for k = 1:size(ans_double,1) if ans_double(k) ==1 selected_signals(i) = (variable_list(k)); %value(i) = workspaceHandle.getVariable(selected_signals(i));
i=i+1; end end selected = selected_signals.'; z = evalin('base','selected');
Best Answer