I have data for lightning and I would like to read them in a loop, perform the row index on each variable given by;
row_idx = (hr == M(:, 2) & -40 <= M(:, 3) & M(:, 3) <= 0 & 135 <= M(:, 4) & M(:, 4) <= 180...
| (-180 < M(:, 4) & M(:, 4) <= -120)); filtered_M = M(row_idx, :);
where M is a dummy variable which has been assigned with the value of the variable, and hr is the hour (which I will already assign as a global variable).
The variables are named as A(year)(month)(day) e.g., A20130101 for data of 1st January 2013, and A20131229 for 29th December 2013 data.
My aim is to read all the variables in a for loop. As each variable is read, I would like to perform the row index operation (mentioned above) on them and store the manipulated variables.
For instance if the read variable is A20130201, then I would like to store the manipulated variable as filtered_A20130201.
I have difficulty reading the variables and storing the resulting matrices.
I have tried this,
for k = 1:n
M = A2013010k;
row_idx = (hr == M(:, 2) & -40 <= M(:, 3) & M(:, 3) <= 0 & 135 <= M(:, 4) & M(:, 4) <= 180 ...
| (-180 < M(:, 4) & M(:, 4) <= -120));
filtered_M = M(row_idx, :);
filtered_A2013010k = filtered_M;
end
but realize my efforts are in vain as I am not familiar with MATLAB coding.