I have a matrix
X = [1 1;2 2;3 3;4 4];
Y = [2 4];
I want a resulting matrix z to have just rows 2 and 4 (the values in Y) of X. That is,
Z = [2 2;4 4];
Any solutions?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is a pretty easily researched question in my opinion: the first result for “MATLAB matrix indexing” answers your question and has a lot more general information about selecting parts of MATLAB matrices.