Help with cell if statement
45 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Trying to make this code work
if Gas_driven(n) == {'Air'}
R = 286.9;
elseif Gas_driven(n) == 'Argon'
R = 208;
else
'Gas Constant not defined'
end
but it keeps coming up with this error
Undefined function or variable 'Air'.
Error in ExpansionShots (line 40)
if Gas_driven(n) == {Air}
1 comentario
Respuestas (1)
Ilham Hardy
el 25 de En. de 2016
Perhaps something like this?
if strcmpi(Gas_driven{n},'Air') == 1
R = 286.9;
elseif strcmpi(Gas_driven{n},'Argon') == 1
R = 208;
else
R = 'Gas Constant not defined';
end
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!