- data, numeric of size 5x20000. Contains the data to be extracted. Each row corresponds to ..., each column is ...
- samplenum, numeric of size 1x1. Contains the value of ...
- triggernum, numeric of size 1xN. Contains the sum of how many ...
Using other matrix data for selection in other matrix?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi, I'm currently working on some trigger data, and I've got my self te samplenumber when the trigger hits. This number is saved in a new matrix called Trigger
- Trigger=N*1 (N=depending on the number of triggers) containing the samplenumber at which a trigger is found
- Data= N*1(N= depending on number of samplenumber, around (20000)contains measurement data
Now what i want to do is select the data by the triggers. So the Value in "trigger" should be used in the function to extract values out of "Data".
What i tried is to create a new variable A1
A1= (Data(Trigger(1,1):Data(Trigger(2,1)) but i couldn't figure it out.
Thanks, Wouter
댓글 수: 2
Stephen23
2015년 4월 10일
편집: Stephen23
2015년 4월 10일
This explanation is confusing, and it should be edited: it would be easier if you simply listed the variables, their size, and what they are for:
or something like that. And then tell us how the rows and columns to be extracted relate to the variables that you define.
Currently the variable nomenclature (naming) is not clear: what values are defined and which are just explanations, and then in the last sentence B does not get referred to at all, and both x and X suddenly appear without being defined.
채택된 답변
Stephen23
2015년 4월 10일
편집: Stephen23
2015년 4월 10일
How to use indices in MATLAB is covered in the documentation:
You could use subscript indices to select the parts of the data matrix that you require.
EDIT based on the edited question, you could probably simply do this:
>> B = Data(Trigger)
Something like this:
>> Data = 100+(1:9).';
>> Trigger = [6;3;7;8;5;1;2;4;9];
>> Data(Trigger)
ans =
106
103
107
108
105
101
102
104
109
retrieves the values in Data according to the sequence of values in Trigger. If you only need the data values for some particular Trigger valuese, then you can select only these ones:
>> Data(Trigger([1,2,9]))
ans =
106
103
109
You might like to consider doing these tutorials, they will help you to understand and use MATLAB effectively:
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!