I want to change a single element in a vector:
function vecteur_avec_delai=delai(input_vecteur, iteration)
vecteur_avec_delai(iteration,1) = input_vecteur(iteration,1);
end
input_vecteur is a vector of size 6001 -by- 1 filled with the same value: 61.46 , and vecteur_avec_delai = ones(6001,1)
I want to change one value of vecteur_avec_delai to 61.46, so to still have a vector of length 6001, filled with ones except one cell with a value equal to 61.46, thus the vecteur_avec_delai(iteration,1) = input_vecteur(iteration,1);
When I run :
vecteur_avec_delai=delai(input_vecteur, iteration)
It compiles but gives me for output a vecteur_avec_delai of size (iteration, 1 ) filled with 0s except for the last value equal to 61.46.
When I try this operation "manually" (directly in the MATLAB command window), it works, so why doesn't it when I go through this function?