Info

この質問は閉じられています。 編集または回答するには再度開いてください。

find values from two matrix and save into new variable

4 ビュー (過去 30 日間)
FAISAL
FAISAL 2016 年 7 月 13 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi, I have a matlab question. Ok for example, I have 2 matrixes of 1x350 each, one gives the information of mix Frac, and the other one gives the information of Temp. For example,
Mix Frac 0.1 0.22 0.32 0.32 0.5 0.2 0.21 0.23 ...... Temp 300 1200 580 560 1200 1320 1500 1360 .....
What I want to do is to find the Mix Frac of a range of 0.19-0.21, and at the same time gives me the information of the Temp for that Mix Frac. So for example from the above two matrixes, it will create a new variable like below which only gives me the information of the temperature that in the range of the mixture fraction I asked….
Mix Frac 0.2 0.21 Temp 1320 1500
Thanks!

回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2016 年 7 月 13 日
編集済み: Andrei Bobrov 2016 年 7 月 13 日
Mix_Frac = Mix_Frac(:);
Temp = Temp(:);
t = Mix_Frac >= .19 & Mix_Frac <= .21;
out = [Mix_Frac(t), Temp(t)];
  1 件のコメント
FAISAL
FAISAL 2016 年 7 月 13 日
Ah thanks it works! but i forgot to state earlier, that i am running a loop (i=30), so if it run for the second and so on, it will overrite that value. how to keep the value in a way that for the second and so on, it will keep adding a new row? thanks!

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by