how to store a matrix in variables

18 visualizzazioni (ultimi 30 giorni)
Newman
Newman il 22 Feb 2016
Risposto: Dennie il 22 Feb 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

Risposta accettata

Dennie
Dennie il 22 Feb 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

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by