⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 savedata.m

📁 等高线拟合源代码(matlab源码)
💻 M
字号:
function savedata(dummy)

% Part of GUI to save list of points and all visible 'information' to a file

% All the software included in this package is presented as is.
% It may be distributed freely. The author can, however, not be
% held responsible for any problems whatever.
% 
% Designed by Johan Baeten.
% Last updated: 22-03-2000
% Johan.baeten@mech.kuleuven.ac.be

global FILENAME
global PATHNAME
global FITHANDLES
global FILECHANGED

nrfpts = get(FITHANDLES(1,12),'value');

if nargin == 1,
   if exist('temps.mat'),
   	delete temps.mat;
	end
   
else
	if nrfpts == 0,
	   seterror(' There is nothing to save.   If you only want to save the image use ''Save Image'' instead.');
	   return
	end

	seterror('');
	[filename, PATHNAME]= uiputfile('*.mat','Save Data As');
	if filename == 0;
 		seterror(' ... Canceled')
	return
	end
	filename = lower(filename);
	PATHNAME = lower(PATHNAME);

	lf = length(filename);
	ok = 0;
	if lf>4,
   if strcmp(filename(lf-3:lf),'.mat'),
      if lf < 12,
         FILENAME = filename;
         ok = 1;
      else
         seterror(' Error: Filename to long.');
         return;
      end
   end
	end 
	if ~ok,  
   for i =1:lf 
      if filename(i) == '.',
         seterror(' Error: Incorrect filename.');
         return;
      end
   end
   if lf<9,
      FILENAME = [filename,'.mat'];
   else
      seterror(' Error: Filename to long.');
      return
   end
	end

end


nroffits = 0;
maxallowednroffits = 20;

fcolor  = {};
fstyle = {};
fdatax  = {};
fdatay  = {};
fmarker = {};
xp = [];
yp = [];

xlim = get(gca,'xlim');
ylim = get(gca,'ylim');
xsize = xlim(2)-xlim(1);
ysize = ylim(2)-ylim(1);
clear xlim ylim;

h = get(gca,'children');

for i = 1 : length(h);
   if strcmp(get(h(i),'Type'),'image'),
     % do nothing
   elseif strcmp(get(h(i),'Type'),'line'),
     nroffits = nroffits + 1;
     if nroffits > maxallowednroffits,
       seterror('Number of fits exceeds maximum allowed number. Some fits are not saved!') 
     else
       fcolor(nroffits,1:3) = get(h(i),'color');
       fstyle{nroffits} = get(h(i),'LineStyle');
       fmarker{nroffits} = get(h(i),'marker');
       fdatax{nroffits} = get(h(i),'xdata');
       fdatay{nroffits} = get(h(i),'ydata');
     end
   end
end

for i=1:nrfpts,
   xp(i) = get(FITHANDLES(3,i),'value');
   yp(i) = get(FITHANDLES(4,i),'value');
end

fit_data = {fdatax; fdatay; fcolor; fstyle; fmarker; xp ;yp ; xsize; ysize };


if nargin ==1,
   eval(['save temps.mat  fit_data']);

else
	eval(['save ' PATHNAME FILENAME ' fit_data' ]);

	FILECHANGED = 0;
	setting('showtitle');
	seterror([' All data saved to ''', FILENAME ,''' .']);
end



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -