data extract from 3d line plot?
조회 수: 3 (최근 30일)
이전 댓글 표시
답변 (2개)
Max Murphy
2019년 12월 28일
See example code and modify according to your data:
%% Make test data
fig = figure;
ax = axes(fig);
nPoint = 1001;
nSeries = 5;
k = ones(nSeries,1) * linspace(0,100,nPoint);
theta = randn(nSeries,1);
% Toy x-data
x = cos(k.*2*pi*0.1+2*pi.*theta).^(randi(4,5,1)).*(randn(nSeries,1) * 10);
% Toy y-data
y = randn(nSeries,nPoint) .* (randn(nSeries,1) * 10);
% Toy z-data
z = sin(k.*2*pi*0.1 + 2*pi.*theta).*(randn(nSeries,1) * 10);
% Labels
lab = cell(nSeries,1);
for i = 1:nSeries
lab{i} = sprintf('TestData %g',i);
end
% Plot them
plot3(ax,x.',y.',z.');
legend(lab);
%% Get 3D data
% Can use 'gca' here if don't have 'ax' handle
c = findobj(ax,'Type','line');
% c = findobj(gca,'Type','line'); % should work for your data
% This returns data in cell array, where each element matches
X = get(c,'XData'); % X{1,1} corresponds to Y{1,1} and Z{1,1}
Y = get(c,'YData'); % Y{2,1} corresponds to X{2,1} and Z{2,1} etc
Z = get(c,'ZData');
댓글 수: 0
Image Analyst
2019년 12월 28일
If all you have is that one 2-D image, you can't. Exactly what data do you have? Are you the one who plotted it? If not, can you get it from them. Otherwise can you get the formulas that made those curves?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!