How to convert 50x1 double to 1x100 double?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to convert 50x1 double to 1x100 double
1 commentaire
Réponses (1)
Steven Lord
le 12 Déc 2022
How do you want the additional 50 elements to be created?
Or to give a smaller example, take y.
y = (1:5).^2
If we wanted to create a vector x from y and have x contain 10 elements, how do you want to generate those elements?
Duplicating those elements?
x1 = repmat(y, 1, 2)
x2 = repelem(y, 2)
Pad with some placeholder values?
x3 = [y, zeros(1, 5)]
x4 = [NaN(1, 5), y]
Interpolation & extrapolation?
x5 = interp1(y, 1:0.5:5.5, 'linear', 'extrap')
x6 = interp1(y, 1:0.5:5.5, 'spline', 'extrap')
Or some other method?
0 commentaires
Voir également
Catégories
En savoir plus sur Matrices and Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!