Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function geodata
- % SIMPLE_GUI2 Select a data set from the pop-up menu and display
- f = figure('Position',[400,400,600,500]);
- h = [];
- % Construct the components.
- h(1) = uicontrol('Style','popupmenu',...
- 'String',{'Peaks','Membrane','Sinc'},...
- 'Position',[500,20,100,25],...
- 'Callback',@popup_menu_Callback);
- h(2) = axes('Units','pixels','Position',[50,30,355,355]);
- h(3) = uicontrol('Style','pushbutton',...
- 'String','Rotate',...
- 'Position',[500,60,100,25],...
- 'Callback',@rotate);
- % Assure resize automatically.
- f.Units = 'normalized'; set(h, 'Units', 'normalized');
- set(h, 'FontSize', 12);
- % Generate the data to plot.
- peaks_data = peaks(35);
- membrane_data = membrane;
- [x,y] = meshgrid(-8:.5:8);
- r = sqrt(x.^2+y.^2) + eps;
- sinc_data = sin(r)./r;
- % Create a plot in the axes.
- current_data = peaks_data;
- surf(current_data);
- %view([-90 0]); % forran
- %view([0 0]); % fra siden
- %view([-90 90]); % top
- % Pop-up menu callback. Read the pop-up menu Value property to
- function popup_menu_Callback(source,eventdata)
- % Determine the selected data set.
- str = get(source, 'String');
- val = get(source,'Value');
- % Set current data to the selected data set.
- switch str{val}
- case 'Peaks'
- % User selects Peaks.
- current_data = peaks_data;
- case 'Membrane'
- current_data = membrane_data;
- case 'Sinc'
- current_data = sinc_data;
- end
- surf(current_data);
- % set view
- end
- function rotate(source,eventdata)
- %view([-90 90])
- %direction = [0 0 1];
- %rotate(f, direction, 1)
- for z = -400:5:400
- campos([0,0,z])
- camroll(1);
- drawnow
- pause(0.05);
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement