필터 지우기
필터 지우기

How to change a portion of cell array?

조회 수: 3 (최근 30일)
Mirthand
Mirthand 2021년 3월 31일
댓글: Star Strider 2021년 3월 31일
I have a large data set where I've put trials into a cell array. So each cell contains 1 trial and within that cell trial{1,1} there is specific information about the trial. The first column in trial{1,1} is time.
How do you access the first column for each cell?
In the end, I want to change the first column to have time start from 0. So I plan on doing time = time-1

채택된 답변

Star Strider
Star Strider 2021년 3월 31일
Guessing as to what the structure is, try this:
trial{1} = {(1:10).', rand(10,1), 'Information'};
FirstColumn = trial{1}{:,1}
SecondColumn = trial{1}{:,2}
ThirdElement = trial{1}{3}
producing (in this random run):
FirstColumn =
1
2
3
4
5
6
7
8
9
10
SecondColumn =
0.76396
0.8182
0.10022
0.17812
0.35963
0.056705
0.52189
0.33585
0.17567
0.20895
ThirdElement =
'Information'
.
  댓글 수: 6
Mirthand
Mirthand 2021년 3월 31일
Thank you!
Star Strider
Star Strider 2021년 3월 31일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by