need help in this
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Nasir Qazi
am 18 Feb. 2012
Bearbeitet: Cedric
am 15 Okt. 2013
can somebody tell me the purpose of this 'sol' sol(1,1)=P; sol(2,1)=X(5);
can you give examples
0 Kommentare
Akzeptierte Antwort
Wayne King
am 18 Feb. 2012
Apparently sol is an MxN matrix. The code is simply assigning the 1st row, 1st column the value of P. And the second row, first column the value of X(5) -- the fifth element of X.
Without more details, that's all the help I can give.
P = 5;
% create a random vector X so we can select the fifth element
X = randn(100,1);
% create a 2x2 matrix of zeros
sol = zeros(2,2);
% set 1st row, 1st column equal to P
sol(1,1) = P;
%set 2nd row, 1st column equal to the fifth element of X
sol(2,1) = X(5);
3 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!