adding values to the same column
Show older comments
hi there, I have a matlab question. Ok for example, I have 2 array of 1x350 each, one gives the information of mixture fraction, and the other one gives the information of temperature. 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 mixture fraction of a range of 0.19-0.21, and at the same time gives me the information of the temperature for that mixture fraction. So for example from the above ‘array’, 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
so i have got an answer for this, which it can be found by
xnMix_frac = xnMix_frac(:);
xnTemp = xnTemp(:);
t = xnMix_frac >= .19 & xnMix_frac <= .21;
out = [xnMix_frac(t), xnTemp(t)];
however, i am running a loop, so the 'out' will get overwritten. as in each loop, the number of xnMix_frac that satisfies the criteria is not the same, so i couldnt use the 'out=[out i+rand]'.
i was wondering if for every loop, it is possible to keep adding the data on the same column of 'out' in the new row and so on?
for example, the first two mix frac and temp value is from the first loop, and the last four from the second loop and so on?
Mix Frac 0.2 0.21 0.2 0.19 0.2 0.2
Temp 1320 1500 1300 1300 1450 1700
thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Common Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!