Filling a matrix with a for loop, calling content from a second matrix
Show older comments
I have a matrix containing a stream of continuous data in the following format:
Frame Fluo
1 0,003
2 0,003
3 0,004
4 0,001
5 0,001
6 0,001
7 0,001
8 0,002
9 0,002
10 0,002
etc...........
And a second matrix that states when a specific event happens within that stream of data
EventStartingFrame
1132
1944
2366
2994
3596
4370
5189
6005
6469
7205
etc.........
My goal is to extract the values of Fluo in an interval of +120 frames after the frame indicated by the second matrix and place it in another matrix.
So far this is what I've written. It works, but only place the last interval of values in the new matrix. How can I make it fill in the matrix with all the individual sub-series? For example one in each column?
%gets the datastream file
datastream = uigetfile('.xlsx')
%gets the event repository file
eventframes = uigetfile('.xlsx')
%puts the files into a matrix
DATA = xlsread(datastream)
EVENT = xlsread(eventframes)
%preallocate the results matrix, suppose I have 100 events
RESULTS = zeros(120,100)
%fill in the matrix
for i=EVENT(1:end,1)
j=i+119
RESULTS = M(i:j,2)
MAT(:,:) = RESULTS
end
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!