how to store a matrix in variables

13 visualizaciones (últimos 30 días)
Newman
Newman el 22 de Feb. de 2016
Respondida: Dennie el 22 de Feb. de 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

Respuesta aceptada

Dennie
Dennie el 22 de Feb. de 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

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by