divide the matrix (Rx2) into submatrices based on the values of the second column
Mostra commenti meno recenti
HI! I tried to split the 'matrix_out' matrix into submatrices with steps of 0.1 and for the most part I succeeded.
load matrix_out
% =======
matrix_out_0 = matrix_out(matrix_out(:,2) < 0.1, :);
tot_percent_matrix_out_0 = sum(matrix_out_0(:,2));
matrix_separation_0 = [{matrix_out_0}, tot_percent_matrix_out_0];
% =======
matrix_separation = {};
j = 0.1:0.1:1.2;
for K = 1:width(j)
matrix_out_new = matrix_out((matrix_out(:,2) >= j(K) & matrix_out(:,2) < (0.1*K)+0.1), :);
tot_percent_matrix_out_new = sum(matrix_out_new(:,2));
matrix_separation = [matrix_separation; {matrix_out_new},tot_percent_matrix_out_new];
end
matrix_separation = [matrix_separation_0 ; matrix_separation]
In the code, however, I noticed that the value 423|1.2 is found both in the penultimate and in the last cell inside 'matrix_separation'.
The value 423|1.2 should only appear in the last cell given the range >=1.2 & <1.3! Thanks to whoever solves this doubt...

Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Multidimensional Arrays in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!