Hello! I'm a new user, so sorry if I'm doing a stupid question, but here is my problem: Instead of having this program:
CO2_Tc = 304.12; H2O_Tc = 647.14; Name = input('Input name: ','s'); switch Name case 'CO2' T = input('Input temperature: '); Tc = CO2_Tc; Tr = T/Tc case 'H2O' T = input('Input temperature: '); Tc = H2O_Tc; Tr = T/Tc otherwise disp('Invalid name')end
Could I have something like:
CO2_Tc = 304.12; H2O_Tc = 647.14; Name = input('Input name: ','s'); T = input('Input temperature: '); Tc = (Name)_Tc; %Here, Name would be replaced by the user's input, like CO2 or H2O
Tr = T/Tc
Is it possible?
Best Answer