<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki-pnb.eri.ucsb.edu/index.php?action=history&amp;feed=atom&amp;title=Bt_ac9.m</id>
	<title>Bt ac9.m - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki-pnb.eri.ucsb.edu/index.php?action=history&amp;feed=atom&amp;title=Bt_ac9.m"/>
	<link rel="alternate" type="text/html" href="https://wiki-pnb.eri.ucsb.edu/index.php?title=Bt_ac9.m&amp;action=history"/>
	<updated>2026-05-22T09:33:58Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>https://wiki-pnb.eri.ucsb.edu/index.php?title=Bt_ac9.m&amp;diff=181&amp;oldid=prev</id>
		<title>128.111.101.185: Created page with '&lt;pre&gt; % command file for matlab bottom top determination: Daniel C. Konnoff % 10/08/92 % modified: JBU Oct 97 - fits new 1997 ac9 processing scheme %         - yadda yadda yadda …'</title>
		<link rel="alternate" type="text/html" href="https://wiki-pnb.eri.ucsb.edu/index.php?title=Bt_ac9.m&amp;diff=181&amp;oldid=prev"/>
		<updated>2010-08-02T23:55:01Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;&amp;lt;pre&amp;gt; % command file for matlab bottom top determination: Daniel C. Konnoff % 10/08/92 % modified: JBU Oct 97 - fits new 1997 ac9 processing scheme %         - yadda yadda yadda …&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
% command file for matlab bottom top determination: Daniel C. Konnoff&lt;br /&gt;
% 10/08/92&lt;br /&gt;
% modified: JBU Oct 97 - fits new 1997 ac9 processing scheme&lt;br /&gt;
%         - yadda yadda yadda&lt;br /&gt;
% modified: SRW 98 - now a function that returns [d]&lt;br /&gt;
function [d]=bt_ac9(mat_in);&lt;br /&gt;
clf;&lt;br /&gt;
					% set graph geometry&lt;br /&gt;
set (gcf,'units','inches', 'pos',[2 1 9 5])&lt;br /&gt;
					% declare variables&lt;br /&gt;
u=[];					% holds the points&lt;br /&gt;
d=[];					% holds the index's only&lt;br /&gt;
cast=0;&lt;br /&gt;
plot(mat_in(:,1),mat_in(:,2),'.');grid; &lt;br /&gt;
while(1)&lt;br /&gt;
  cast=cast+1&lt;br /&gt;
  which=['Selecting points for cast: ',num2str(cast)];&lt;br /&gt;
					% first point&lt;br /&gt;
  disp('select the first region')&lt;br /&gt;
  title(which);&lt;br /&gt;
  [x,y]=ginput(2);&lt;br /&gt;
					% zoom to start point of the cast&lt;br /&gt;
  if y(1)&amp;lt;y(2)&lt;br /&gt;
    if x(1)&amp;lt;x(2)&lt;br /&gt;
      axis([x(1),x(2),y(1),y(2)])&lt;br /&gt;
    else&lt;br /&gt;
      axis([x(2),x(1),y(1),y(2)])&lt;br /&gt;
    end&lt;br /&gt;
  else&lt;br /&gt;
    if x(1)&amp;lt;x(2)&lt;br /&gt;
      axis([x(1),x(2),y(2),y(1)])&lt;br /&gt;
    else&lt;br /&gt;
      axis([x(2),x(1),y(2),y(1)])&lt;br /&gt;
    end					% end if&lt;br /&gt;
  end					% end if&lt;br /&gt;
					% pretty the graph&lt;br /&gt;
  hold on&lt;br /&gt;
  plot(mat_in(:,1),mat_in(:,2),'ro'); grid; title(which);&lt;br /&gt;
  plot([x(1), x(2)], [0, 0], 'g-.'); &lt;br /&gt;
  hold off;&lt;br /&gt;
					% find specific start point&lt;br /&gt;
  disp('click on start of cast')&lt;br /&gt;
  [x,y]=ginput(1);&lt;br /&gt;
                                        % add the points to cast_id array&lt;br /&gt;
  u=[u;x,y];				&lt;br /&gt;
					% last point&lt;br /&gt;
  plot(mat_in(:,1),mat_in(:,2),'.');grid; title(which);&lt;br /&gt;
  hold on;&lt;br /&gt;
  %d=ceil(u(:,1))&lt;br /&gt;
  d=[];&lt;br /&gt;
  for id=1:size(u,1),&lt;br /&gt;
    dd=find(mat_in(:,1)&amp;lt;u(id,1));%___________________________&lt;br /&gt;
    d=[d; dd(end)];%-----------------------------------------&lt;br /&gt;
  end&lt;br /&gt;
  for ip=1:2:size(d,1),&lt;br /&gt;
      plot(u(:,1),u(:,2),'ro');&lt;br /&gt;
  end&lt;br /&gt;
% $$$   plot(mat_in(d(1):d(end),1),...&lt;br /&gt;
% $$$        mat_in(d(1):d(end),2),'g',u(:,1),u(:,2),'ro');&lt;br /&gt;
  disp('select the end region')&lt;br /&gt;
  [x,y]=ginput(2);&lt;br /&gt;
					% zoom to end point of the cast&lt;br /&gt;
  if y(1)&amp;lt;y(2)&lt;br /&gt;
    if x(1)&amp;lt;x(2)&lt;br /&gt;
      axis([x(1),x(2),y(1),y(2)])&lt;br /&gt;
    else&lt;br /&gt;
      axis([x(2),x(1),y(1),y(2)])&lt;br /&gt;
    end&lt;br /&gt;
  else&lt;br /&gt;
    if x(1)&amp;lt;x(2)&lt;br /&gt;
      axis([x(1),x(2),y(2),y(1)])&lt;br /&gt;
    else&lt;br /&gt;
      axis([x(2),x(1),y(2),y(1)])&lt;br /&gt;
    end					% end if&lt;br /&gt;
  end					% end if&lt;br /&gt;
					% pretty the graph&lt;br /&gt;
  hold on&lt;br /&gt;
  plot(mat_in(:,1),mat_in(:,2),'ro');grid; title(which);&lt;br /&gt;
  plot([x(1), x(2)], [0, 0], 'g-.'); &lt;br /&gt;
  hold off;&lt;br /&gt;
					% find specific end point&lt;br /&gt;
  disp('click on end of cast')&lt;br /&gt;
  [x,y]=ginput(1);&lt;br /&gt;
                                        % add the points to cast_id array&lt;br /&gt;
  u=[u;x,y];			&lt;br /&gt;
					% are we done yet?&lt;br /&gt;
  axis('auto');&lt;br /&gt;
  plot(mat_in(:,1),mat_in(:,2),'.');grid; title(which);&lt;br /&gt;
  hold on;&lt;br /&gt;
  %d=ceil(u(:,1))&lt;br /&gt;
  d=[];&lt;br /&gt;
  for id=1:size(u,1),&lt;br /&gt;
    dd=find(mat_in(:,1)&amp;lt;u(id,1));&lt;br /&gt;
    d=[d; dd(end)];&lt;br /&gt;
  end&lt;br /&gt;
  for ip=1:2:size(d,1),&lt;br /&gt;
      plot(mat_in(d(ip):d(ip+1),1),...&lt;br /&gt;
       mat_in(d(ip):d(ip+1),2),'g',u(:,1),u(:,2),'ro');&lt;br /&gt;
  end  &lt;br /&gt;
% $$$   plot(mat_in(d(1):d(end),1),...&lt;br /&gt;
% $$$        mat_in(d(1):d(end),2),'g',u(:,1),u(:,2),'ro');&lt;br /&gt;
  title('Selected points'); grid;&lt;br /&gt;
  disp(' ');&lt;br /&gt;
  %disp('Want to save these points?');&lt;br /&gt;
  %done=input('y or n: ','s');&lt;br /&gt;
  %disp(' ')&lt;br /&gt;
  % $$$ if (done=='y'|done=='Y')&lt;br /&gt;
  % $$$  d(1,1)=ceil(u(1,1));			%  copy index's to d vector&lt;br /&gt;
  % $$$  d(2,1)=floor(u(2,1));&lt;br /&gt;
  % $$$  d=[d, mat_in(d,1), -mat_in(d,2)];&lt;br /&gt;
  % $$$  disp('Your final cast_id array:')&lt;br /&gt;
  % $$$  disp(d)&lt;br /&gt;
  % $$$  save bt.pts d /ascii;&lt;br /&gt;
  % $$$ else&lt;br /&gt;
  % $$$  disp('castID not saved, re-run by typing &amp;quot;bt_ac9&amp;quot; at the prompt');&lt;br /&gt;
  % $$$ end					% end if-else&lt;br /&gt;
  ButtonName=questdlg('Save these points to CastID matrix?',...&lt;br /&gt;
      '','Yes','No','No');&lt;br /&gt;
  switch ButtonName,&lt;br /&gt;
    case 'Yes'&lt;br /&gt;
      %d=ceil(u(:,1));&lt;br /&gt;
      d=[];&lt;br /&gt;
      for id=1:size(u,1),&lt;br /&gt;
        dd=find(mat_in(:,1)&amp;lt;u(id,1));&lt;br /&gt;
        d=[d; dd(end)];&lt;br /&gt;
      end&lt;br /&gt;
      %d(1,1)=ceil(u(1,1))			%  copy index's to d vector&lt;br /&gt;
      %d(2,1)=floor(u(2,1))&lt;br /&gt;
    case 'No'&lt;br /&gt;
      disp('Points not saved to castID, ');&lt;br /&gt;
      for ip=1:2:size(d,1),&lt;br /&gt;
	plot(mat_in(d(ip):d(ip+1),1),...&lt;br /&gt;
	     mat_in(d(ip):d(ip+1),2));&lt;br /&gt;
      end  &lt;br /&gt;
      u(length(u)-1:length(u),:)=[];&lt;br /&gt;
      %d=ceil(u(:,1));&lt;br /&gt;
      d=[];&lt;br /&gt;
      for id=1:size(u,1),&lt;br /&gt;
        dd=find(mat_in(:,1)&amp;lt;u(id,1));&lt;br /&gt;
        d=[d; dd(end)];&lt;br /&gt;
      end&lt;br /&gt;
  end % switch&lt;br /&gt;
  ButtonName=questdlg('Pick points for another cast?',...&lt;br /&gt;
      '','Yes','No','No');&lt;br /&gt;
  switch ButtonName,&lt;br /&gt;
    case 'Yes'&lt;br /&gt;
    case 'No'&lt;br /&gt;
      if ~isempty(d),&lt;br /&gt;
	d=[d, mat_in(d,1), -mat_in(d,2)];&lt;br /&gt;
	disp('Your final cast_id array:')&lt;br /&gt;
	disp(d)&lt;br /&gt;
    %cd(pb) %--------------------------&lt;br /&gt;
	save bt.pts d /ascii;&lt;br /&gt;
   % cd ..&lt;br /&gt;
      end&lt;br /&gt;
      return;&lt;br /&gt;
  end % switch&lt;br /&gt;
 &lt;br /&gt;
end % while  &lt;br /&gt;
return&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;[[bt_ac9]]&amp;lt;big&amp;gt;&lt;/div&gt;</summary>
		<author><name>128.111.101.185</name></author>
		
	</entry>
</feed>