How to convert Contour subscripts to indices
Show older comments
Hello,
I am trying to get the linear indices of subscripts that are derived from a contour plot.
I am first making the contour using:
[membranePoints1] = contour(1:matSize(2), 1:matSize(1), membranePotentialFunction1, [0 0 0], 'k');
Giving a plot that looks like this:

Then using a script from file exchange to extract out the x, y coordinates I get an array of 2Xnumber of rows :
[xc,yc] = C2xyz(membranePoints1);
I then am trying to convert these coordinates to a linear index for following computations using the function:
schemeData1.indexValues1 = sub2ind([matSize(2) matSize(1)], xc{1}, yc{1});
But if I convert these indicies back to xy values using
[ivR1, ivR2] = ind2sub(matSize, schemeData1.indexValues1);
My plot looks like this:

Is there any advice as to what may be happening?
Thank you
Accepted Answer
More Answers (0)
Categories
Find more on Contour Plots 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!