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

1 次查看(过去 30 天)
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.

采纳的回答

Orion
Orion 2014-10-16
编辑:Orion 2014-10-16
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by