Diluting large arrays by eliminating columns whose numbers are factos of an integer
2 views (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
Walter Roberson
on 5 Nov 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
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!