Correlating Time steps to frame numbers that are potentially non-continuous

4 views (last 30 days)
Hello community!
I am trying to add an MxN double to a cell array that has tables inside each column that are MxP preferably at the beginning of each of the individual tables within the array. I went about this doing this :
for i= 1:table_heightsN
ArrayN{i,1} = [ table(sec, 'VariableNames', {'Time'}) ArrayN{i,1}];
end
However, in doing so I neglect to account for tables within ArrayN that are not size M (due to their drifting in and out of data acquisition range). I would also get an error because I am attempting to add an MxN double to a Table that is less than MxN for the smaller tables.
Instead what I would like, is for a certain image frame to be associated with the Time column, so if a frame is skipped, the Time column does not add the wrong one.
I have a feeling that I will have to use my TT.mat file and somehow associate the Index Column to the ArrayN.mat ImageNumber Column, but I have no idea how to do that.
Just for reference, I used TT.mat to form sec.mat through:
for z = 1:height(TT)
sec(z,:)=sum(sscanf(string(TT{z,2}),'%f:%f').*[60;1]);
end
Any suggestions would be appreciated!! I have attached all three files for convenience. Thanks community!
Nick

Accepted Answer

Nicholas Scott
Nicholas Scott on 27 Jun 2022
With the help of a colleague, I have answered my own question in a rough manner. It increases the computing time by a decent bit. I would like to hear more optimized suggestions if any exist before marking anything as solved. Here is the code:
for i= 1:length(table_heightsN)
ArrayN{i,1}.Timestamp = zeros(table_heightsN(i),1);
[row,col] = size(ArrayN{i,1});
for j=1:row
FrameNum = ArrayN{i,1}.ImageNumber(j);
FrameNum = FrameNum+1;
ind1 = find(TT.Index == FrameNum);
ArrayN{i,1}.Timestamp(j) = sum(sscanf(char(TT.Time_m_s_ms_(ind1)),'%f:%f').*[60;1]);
end
end

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!