Finding Rest of Row

조회 수: 5 (최근 30일)
Anjali Parmar
Anjali Parmar 2020년 2월 19일
댓글: Anjali Parmar 2020년 2월 19일
Hello! Matlab newbie here. So I have a bunch of data in rows/columns. If I have a variable assigned to something in a specific row in column 1, how do I find the values in the rest of the row in the rest of the columns (there's like five total)? I appreciate any help!

채택된 답변

Gifari Zulkarnaen
Gifari Zulkarnaen 2020년 2월 19일
Do you mean like vlookup in excel? Try this:
data = randi(1,4,5); % Just an example matrix
first = data(randi(4),1); % Example of desired number in first column
index = data(:,1) == first; % Find in which row is your desired number located
rest = data(index,2:end); % Get the rest of columns of that row
  댓글 수: 1
Anjali Parmar
Anjali Parmar 2020년 2월 19일
Oh I see! Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by