home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 3.ddi / DEMOS.DI$ / EARTHMAP.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  1.2 KB  |  40 lines

  1. %EARTHMAP View Earth's topography
  2.  
  3. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  4.  
  5. echo off
  6. disp('The topography data used in this demo is available from')
  7. disp('the National Geophysical Data Center, NOAA,')
  8. disp('US Department of Commerce under data announcement 88-MGG-02.')
  9. load topo
  10. clf reset
  11. colormap(topomap1)
  12. [x,y,z] = sphere(24);
  13. a = min(min(topo));
  14. b = max(max(topo));
  15. to = fix(64*(topo-a)/(b-a)+1);
  16. to(find(to>64)) = 64;
  17.  
  18. labels = str2mat(...
  19.     '2-D Contour', ...
  20.     '2-D Image', ...
  21.     '3-D Pseudocolor');
  22.  
  23. % Callbacks
  24. s = str2mat(...
  25.     'contour(-179:180,-89:90,topo,[0 0]),axis image,axis([-180 180 -90 90])', ...
  26.     'image([-180 180],[-90 90],to), axis xy, axis image', ...
  27.     ['cla,axis auto,surface(x,y,z,''FaceColor'',''texture'',''Cdata'',topo), ', ...
  28.         'axis square,axis xy,axis off, view(3)']);
  29.  
  30. cs = 'point = get(gcf,''pointer'');set(gcf,''pointer'',''watch'');drawnow,';
  31. ce = ';set(gcf,''pointer'',point),drawnow';
  32.  
  33. for n=1:size(labels,1)
  34.     rect = [.03 .01 .28 .06];
  35.     uicontrol('units','normal','position',rect+[(n-1)*.31 0 0 0],...
  36.                   'string',labels(n,:),'horiz','center','callback',[cs s(n,:) ce]);
  37. end
  38. axis off
  39. text(.5,.5,'Select a view of the earth.','horiz','center');
  40.