how to store a matrix in variables

13 次查看(过去 30 天)
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

采纳的回答

Dennie
Dennie 2016-2-22
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by