MATLAB: Diluting large arrays by eliminating columns whose numbers are factos of an integer

array filteringlarge arrays

Dealing with a numerical problem, sometimes my program ends up producing large data arrays(e.g. 100X1000). Due to numerical limits I cannot make the program work with smaller steps (and smaller arrays as a consequence) but I would like to "dilute" the results matrix to e.g. a tenth of the original number of columns. This means when I want to write the data to an excel file at the end, I would rather only write every tenth column of the whole array into the output file. How can I do this without using a loop?

Best Answer

start_col = 10;
data_to_write = your_data(:, start_col:10:end);
Adjust start_col according to whether you want columns 1, 11, 21, ... written, or columns 10, 20, 30, ... written
Related Question