Meaning of x = X(training(c,1),:);
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Kindly explain me the meaning of X (training(c,1),:)? what is the significance of : in matlab commands?
0 Kommentare
Antworten (1)
Stephen23
am 29 Apr. 2016
Bearbeitet: Stephen23
am 29 Apr. 2016
Why not use the power of the internet to learn how MATLAB works? I used [an internet search engine] to search for "MATLAB colon" and the very first result was this very informative page:
At the top of the page is written "The colon is one of the most useful operators in MATLAB", and just a few lines down the page I found this example:
A(i,:) is the ith row of A.
which matches your example. After reading that page we learn that the line
X(training(c,1),:)
uses indexing to return the training(c,1)-th rows of the variable X. Alternatively you can think of the colon as meaning "all columns" of X (because it is used as the column index).
Here is a simple example:
>> X = [1,2;3,4] % define a matrix
X =
1 2
3 4
>> X(1,:) % pick the first row and all columns
ans =
1 2
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!