How to use linear interpolation to fill gaps to generate a contour (closed surface)
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
M.S. Khan
am 26 Jul. 2019
Kommentiert: M.S. Khan
am 27 Jul. 2019
M = 0 0 0
0 0 3
0 3 3
3 3 3
0 0 0
0 0 3
3 0 0
0 0 0
% in the first colmn, btween 4th & 7th rows, i wan to fill 3. in the last column, between 4th and 6th i want to fill 3.
X = ~all(M==0,2)
N = interp1(find(X),M(X,:), 'nearest')
% its not giving me solution.
i am focusing only first and last column to generate controur (closed surface )
Plz need some tips.
your cooperation is highly appreciated.
warm regards
0 Kommentare
Akzeptierte Antwort
madhan ravi
am 26 Jul. 2019
Bearbeitet: madhan ravi
am 26 Jul. 2019
"i am focusing only first and last column..."
M = [0 0 0;...
0 0 3;...
0 3 3;...
3 3 3;...
0 0 0;...
0 0 3;...
3 0 0;...
0 0 0];
Constant = 3; % example value
f = find(M(:,1));
fx = f .* [true;false(numel(f)-1,1)];
M(setdiff(nonzeros(fx):max(f),f),1) = Constant;
l = find(M(:,end));
lx = l .* [true;false(numel(l)-1,1)];
M(setdiff(nonzeros(lx):max(l),l),end) = Constant
3 Kommentare
madhan ravi
am 26 Jul. 2019
Bearbeitet: madhan ravi
am 26 Jul. 2019
I seemed to have answered your original question "% in the first colmn, btween 4th & 7th rows, i wan to fill 3. in the last column, between 4th and 6th i want to fill 3....
i am focusing only first and last column to generate controur (closed surface )" . You would be better off posting a new question.
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Surfaces, Volumes, and Polygons finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!