Effacer les filtres
Effacer les filtres

how to store a matrix in variables

5 vues (au cours des 30 derniers jours)
Newman
Newman le 22 Fév 2016
Réponse apportée : Dennie le 22 Fév 2016
Hello ,
I want to store the following code in the variable:
p=[p(0)...p(M-1)]';
where m is any integer
I am unable to write a code for it .kindly help
  1 commentaire
Chad Greene
Chad Greene le 22 Fév 2016
Can you elaborate?

Connectez-vous pour commenter.

Réponse acceptée

Dennie
Dennie le 22 Fév 2016
I think this is what you want:
input_vector=[ 1 2 3 4 5 6 7 8 9 10];
for i=1:M
p(i)=input_vector(i);
end
Matlab code starts arrays with index 1 and not 0, the example that you have given is coherent to c# style arrays.
Hope this helps,
Dennie

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing 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!

Translated by