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

2 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Walter Roberson
Walter Roberson el 5 de Nov. de 2017
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

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by