returning values of a matrix between two values

Hi Matlab Experts,
I've got a basic question.
If I've created a matrix:
data_bounds = [event_samples(1),event_samples(end)]; % let's say its value is [79502,5316744]
In my case, this data_bounds variable corresponds to column numbers in another matrix (say it is called "data"). How do I pull the columns from data between the values of data_bounds?
Thanks!
PK

답변 (2개)

Aquatris
Aquatris 2018년 8월 23일

0 개 추천

desiredData = data(:,event_samples(1):event_samples(end))
PAK
PAK 2018년 8월 23일

0 개 추천

Hi,
I tried that, but I get the error
"Index in position 2 exceeds array bounds (must not exceed 5272240)".
Do you have any ideas why this may be?
Thanks!
PK

댓글 수: 2

That means the "data" variable does not have 5272240 elements in it, which means you are calculating the bounds wrong.
Or you actually store data as row, in which case you should use
desiredData = data(event_samples(1):event_samples(end),:)
What is the size of your data variable?
PAK
PAK 2018년 8월 30일
Hi, This worked! Thank you!!

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

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2018a

태그

질문:

PAK
2018년 8월 23일

댓글:

PAK
2018년 8월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by