how to read the certain row and column from the cell array?

조회 수: 10 (최근 30일)
muhammad choudhry
muhammad choudhry 2020년 11월 19일
댓글: Setsuna Yuuki. 2020년 11월 19일
HI,
I am working with the large data in which i need to extract the meaning data what is a way to go forward.
FOr Example:
x = [2 3 3 4 45 5 6 5 6 7 5 87876 876 889 8 98 9 079 0 ]
y = [2 3 344 5 546 676 65 7 6 67 98 9 8 90 79 23 4 34]
if i need to pick certain range of number from x and y how would i do that?

채택된 답변

Setsuna Yuuki.
Setsuna Yuuki. 2020년 11월 19일
편집: Setsuna Yuuki. 2020년 11월 19일
Example:
x = [2 3 3 4 45]
x(1:3)
ans =
2 3 3
y = [8 90 79 23 4 34]
y(4:6)
ans =
23 4 34
  댓글 수: 2
muhammad choudhry
muhammad choudhry 2020년 11월 19일
what if, x = 1 2 3 4 4 5 5 6 7 7 88
1 2 3 3 4 4 55 6 67
one variable but have 2 arrays and I want to access the certain data?
Setsuna Yuuki.
Setsuna Yuuki. 2020년 11월 19일
That depends on the dimension of the matrix.
For example:
x = [2 3 4 4 5 5 6 7 7 88 ; 1 2 3 3 4 4 55 6 67 4] %10 columns and 2 rows
x(1,:) %first row, all columns
ans =
2 3 4 4 5 5 6 7 7 88
x(2,:) %second row, all columns
ans =
1 2 3 3 4 4 55 6 67 4
x(1,5:10) %first row and last six elements of the column
ans =
5 5 6 7 7 88
x(rows,columns)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by