Sample evenly-ish vector of unevenly distributed indices
Mostra commenti meno recenti
Say I have a vector of indices
v = [v1 v2 v3 v4 v5] = [1 34 456 1345 4567]
I try to find a way to sample v in an evenly-ish way while keepking these points. Is there a quick way to do that instead of a loop over every range between two points [v_i v_j], I have numerous and long vectors...
4 Commenti
Walter Roberson
il 10 Dic 2021
Could you talk more about the sampling process? Is this like you want (say) 5 locations within each segment? How should the endpoints be treated, included in both, left is included but right isn't? Except right is included in the last segment? Details!
Ouatehaouks
il 10 Dic 2021
Voss
il 10 Dic 2021
How about this:
vnew = min(v):max(v);
Now, as long as v contains only integer values, all elements of v are in vnew. And diff(vnew) is all 1s, so the difference is as constant as it can get.
Does that work?
Ouatehaouks
il 10 Dic 2021
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Creating and Concatenating Matrices 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!