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

1 次查看(过去 30 天)
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?

采纳的回答

Walter Roberson
Walter Roberson 2017-11-5
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by