Take 102 Elements Equally Spaced of an Existing Array
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Fabio Taccaliti
le 1 Juil 2022
Modifié(e) : Adam Danz
le 1 Juil 2022
Hello,
I have an array Fold_Angle_Unsteady_100_Filtered (991x1) and I would like to take 102 elements equally spaced from it, how can I do it? I know I can do something like Fold_Angle_Unsteady_100_Filtered(1:10:end), but then my vector will be 100x1 and not 102x1. Is there a way to solve this issue?
I will then use this method also to other arrays of similar dimensions to find again other sub-arrays of 102x1, for this reason I would like to find a roboust method.
Thanks
0 commentaires
Réponse acceptée
Adam Danz
le 1 Juil 2022
Modifié(e) : Adam Danz
le 1 Juil 2022
> Is there a way to solve this issue?
No. 991 is not divisible by 102.
The following is a 102 vector starting with 1 and ending with 991. Note that these are not integer values so they cannot be used to index the 991 element vector.
y = 1 : 990/101 : 991
max(y)
size(y)
The closest you could do is round but then the intervals will not be uniform
yround = round(1 : 990/101 : 991)
diff(yround)
Depending on what you're doing, you might be able to interpolate and resample.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!