Hi everyone, I'm new to Matlab and trying to help a friend. Basically I have a set of data where I filter only specific columns which are then read via a for loop to find the values that are within certain bounds. Then I want all of them added to a variable, however after each iteration the variable is simply replaced by the next one rather than all kept there. I really searched everywhere and I know it might be a really basic thing but it's better to ask than give up 🙂
dat = readtable('170412E1AM1T0.txt'); dat = dat(:, [1 5]); dat = dat.Variables; for i = 1:length(dat) if 8.5 < dat(i,1) && 8.7 > dat(i,1) a = dat(i,2); elseif 12.5 < dat(i,1) && 12.6 > dat(i,1) b = dat(i,2); elseif 13.2 < dat(i,1) && 13.4 > dat(i,1) c = dat(i,2); elseif 14.5 < dat(i,1) && 14.6 > dat(i,1) d = dat(i,2); endend
Thanks!
Best Answer