Clear Filters
Clear Filters

Performing a loop of data structure array

1 view (last 30 days)
Hi, I have a database named 'data' which contains 1x4 structure array.
I want to make a loop that replace the number of the data incrementally by 1. That is firstly i want to read from data 1, then data 2 ie n=1, m=2.for the next cycle it will read data 2 and data 3 ie n=2, m=3, and lastly n=3, m=4. I've try these command but the output is wrong.Please help me.
for n = 1:1:3
for m = n+1:1:4
index_L=matchFeatures(data(n).fL,data(m).fL);
match1=data(n).vptsL(index_L(:,1));
match2=data(m).vptsL(index_L(:,2));
gte = vision.GeometricTransformEstimator; % defaults to RANSAC
gte.Transform = 'Nonreflective similarity';
gte.NumRandomSamplingsMethod = 'Desired confidence';
gte.MaximumRandomSamples = 1000;
gte.DesiredConfidence = 99.8;
[tform_matrix inlierIdx] = step(gte, match2.Location, ...
match1.Location);
cvexShowMatches(data(n).imgL,data(m).imgL,match1(inlierIdx),...
match2(inlierIdx),'ptsLeft1','ptsLeft2');
end
end

Accepted Answer

Iain
Iain on 4 Jun 2013
Only use one for loop.
for n = 1:1:3
m = n + 1;
... code
end

More Answers (0)

Categories

Find more on Image Processing and Computer Vision 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!