Use string to define variable
Hello guys!
I am looking for a way to name a variable with a string name that will be changing according to the T and V values
My code is the following:
——————————-
T=15; % input variable T
V=1; % input variable V
load(‘FRF_T15_V1.mat’)
load(‘FRF_T15_V2.mat’)
load(‘FRF_T15_V3.mat’)
formatSpec = ‘FRF_T%d_V%d’;
filename = sprintf(formatSpec,T,V);
x=eval(filename);
XP=(x{3,3});
save (‘XP,’XP’)
—————————–
I would like for variable XP to be assigned according to the input values of T and V, e.g.,
FRF_T15_V1_XP=(x{3,3});
And then save it as
save (‘ FRF_T15_V1_XP,’ FRF_T15_V1_XP ‘)
Thanks in advance for your help!
Kind regards,
HugoHello guys!
I am looking for a way to name a variable with a string name that will be changing according to the T and V values
My code is the following:
——————————-
T=15; % input variable T
V=1; % input variable V
load(‘FRF_T15_V1.mat’)
load(‘FRF_T15_V2.mat’)
load(‘FRF_T15_V3.mat’)
formatSpec = ‘FRF_T%d_V%d’;
filename = sprintf(formatSpec,T,V);
x=eval(filename);
XP=(x{3,3});
save (‘XP,’XP’)
—————————–
I would like for variable XP to be assigned according to the input values of T and V, e.g.,
FRF_T15_V1_XP=(x{3,3});
And then save it as
save (‘ FRF_T15_V1_XP,’ FRF_T15_V1_XP ‘)
Thanks in advance for your help!
Kind regards,
Hugo Hello guys!
I am looking for a way to name a variable with a string name that will be changing according to the T and V values
My code is the following:
——————————-
T=15; % input variable T
V=1; % input variable V
load(‘FRF_T15_V1.mat’)
load(‘FRF_T15_V2.mat’)
load(‘FRF_T15_V3.mat’)
formatSpec = ‘FRF_T%d_V%d’;
filename = sprintf(formatSpec,T,V);
x=eval(filename);
XP=(x{3,3});
save (‘XP,’XP’)
—————————–
I would like for variable XP to be assigned according to the input values of T and V, e.g.,
FRF_T15_V1_XP=(x{3,3});
And then save it as
save (‘ FRF_T15_V1_XP,’ FRF_T15_V1_XP ‘)
Thanks in advance for your help!
Kind regards,
Hugo string, variable MATLAB Answers — New Questions