Borrar filtros
Borrar filtros

Using a statement to identify a specific matrix with a given range of values.

1 visualización (últimos 30 días)
I am hoping to get some help with a question concerning using a value range in MatLab. I am trying to write a statement where if the value of a variable falls within a given range, than a specific table of values is selected.
I am using the following code to round values for atmosT and RH:
roud_atmosT = round(atmosT);
roud_RH = round(RH);
and have the following selection of matrices: x15C_ab, x17_5C_ab, x20C_ab, x22_5C_ab, x23C_ab
so for example, "if the value for roud_atmosT is 15 to 17, than ambient_T = 'x15C_ab'
Let me know if you need any more info or further explanation/definition. Thanks for any help you can give.

Respuesta aceptada

Orion
Orion el 16 de Oct. de 2014
Editada: Orion el 16 de Oct. de 2014
Hi,
for what I understand, you need something like
if roud_atmosT>=15 || roud_atmosT<=17
matrix_name = sprintf('x%dC_ab',roud_atmosT);
ambient_T = eval(matrix_name);
end
and then add some else if cases for all your values.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by