Performing a loop of data structure array

1 次查看(过去 30 天)
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

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing and Computer Vision 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by