make vectors same length
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Adam Levschuk
el 6 de Ag. de 2020
Comentada: Matt J
el 7 de Ag. de 2020
Hello,
I input my data as three different variables, acc, gyr, and mag. I want a small amount of code that makes all three variables the length of the shortest variable.
For example, if acc is 12000x1 and gyr is 12000x1, but mag is 12001x1, how can i automate deleting this row to make the vectors all the same length.
Thank you for your help,
Adam
0 comentarios
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 7 de Ag. de 2020
Maybe this:
lastRow = min([length(acc), length(gyr), length(mag)])
% Crop
acc = acc(1 : lastRow);
gyr = gyr(1 : lastRow);
mag = mag(1 : lastRow);
0 comentarios
Ver también
Categorías
Más información sobre Programmatic Model Editing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!