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

📄 sptimport.m

📁 有关matlab的电子书籍有一定的帮助希望有用
💻 M
📖 第 1 页 / 共 3 页
字号:
% This is the [HAND EDITED] machine-generated representation of a 
% MATLAB object
% and its children.  Note that handle values may change when these
% objects are re-created. This may cause problems with some callbacks.
% The command syntax may be supported in the future, but is currently 
% incomplete and subject to change.
%
% To re-open this system, just type the name of the m-file at the MATLAB
% prompt. The M-file and its associtated MAT-file must be on your path.
ud = [];
ss = get(0,'screensize');
h = 308;
w = 587;  % height and width in pixels
% Place window's upper left corner at [40,60] offset from upper left
fp = [40 ss(4)-h-60 w h];
a = figure('Color',get(0,'defaultuicontrolbackgroundcolor'), ...
   'Position',fp, ...
   'IntegerHandle','off',...
   'Name','Import to SPTool',...
   'NumberTitle','off',...
   'Resize','off',...
   'CloseRequestFcn','sbswitch(''sptimport'',''Cancel'')',...
   'Tag','Fig1',...
   'WindowStyle','modal',...
   'HandleVisibility','callback',...
   'units','pixels',...
   'menubar','none');
b = uicontrol('Parent',a, ...
   'units','pixels',...
     'Position',[6 5 324 39], ...
   'Style','frame', ...
   'Tag','Frame6');
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'Position',[353 5 228 38], ...
   'Style','frame', ...
   'Tag','Frame5');
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'Position',[354 53 228 244], ...
   'Style','frame', ...
   'Tag','Frame4');
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'Position',[159 53 147 245], ...
   'Style','frame', ...
   'Tag','Frame3');
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'Position',[7 53 141 245], ...
   'Style','frame', ...
   'Tag','Frame2');
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'Position',[11 151 133 101], ...
   'Style','frame', ...
   'Visible','off',...
   'Tag','Frame1');
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[12 259 125 20], ...
   'String','From Workspace', ...
   'Style','radiobutton', ...
   'Tag','radio1', ...
   'Value',1);
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[12 238 107 20], ...
   'String','From Disk', ...
   'Style','radiobutton', ...
   'Tag','radio2', ...
   'Value',0);
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'HorizontalAlignment','left', ...
   'Position',[27 215 106 20], ...
   'String','MAT-file Name:', ...
   'Style','text', ...
   'Tag','filenameLabel');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'BackgroundColor',[1 1 1], ...
   'CallBack','sbswitch(''sptimport'')', ...
   'HorizontalAlignment','left',...
   'Position',[28 195 110 24], ...
   'Style','edit', ...
   'Tag','filename');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[30 170 106 20], ...
   'String','Browse...', ...
   'Tag','browse');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'Position',[18 286 116 20], ...
   'String','Source', ...
   'Style','text', ...
   'Tag','SourceLabel');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'Position',[166 285 136 20], ...
   'String','Workspace Contents', ...
   'Style','text', ...
   'Tag','ContentsLabel');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'BackgroundColor',[1 1 1], ...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[165 58 136 225], ...
   'Style','listbox', ...
   'Tag','listbox', ...
   'UserData',-1,...
   'Value',1);
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[27 16 60 20], ...
   'String','Help', ...
   'Tag','Help');
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[137 16 60 20], ...
   'String','Cancel', ...
   'Tag','Cancel');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[247 16 60 20], ...
   'String','OK', ...
   'Tag','OKButton');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'Position',[358 283 74 20], ...
   'String','Import As:', ...
   'Style','text', ...
   'Tag','StaticText2');
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[431 283 117 20], ...
   'String',' ', ...
   'Style','popupmenu', ...
   'Tag','importas', ...
   'Value',1);
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'Position',[370 258 60 20], ...
   'String','Form:', ...
   'Style','text', ...
   'Tag','Form');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[420 259 145 20], ...
   'String',' ', ...
   'Style','popupmenu', ...
   'Tag','formPopup', ...
   'Value',1);
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'BackgroundColor',[1 1 1], ...
   'HorizontalAlignment','left', ...
   'Position',[363 228 110 21], ...
   'Style','edit', ...
   'CallBack','sbswitch(''sptimport'')', ...
   'Tag','edit1');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'HorizontalAlignment','left', ...
   'Position',[478 228 100 20], ...
   'String','Label1', ...
   'Style','text', ...
   'Tag','label1');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[312 228 36 20], ...
   'String','-->', ...
   'Tag','arrow1');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[312 195 36 20], ...
   'String','-->', ...
   'Tag','arrow2');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'HorizontalAlignment','left', ...
   'Position',[478 195 100 20], ...
   'String','Label1', ...
   'Style','text', ...
   'Tag','label2');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'BackgroundColor',[1 1 1], ...
   'HorizontalAlignment','left', ...
   'Position',[363 195 110 21], ...
   'Style','edit', ...
   'CallBack','sbswitch(''sptimport'')', ...
   'Tag','edit2');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'BackgroundColor',[1 1 1], ...
   'HorizontalAlignment','left', ...
   'Position',[363 162 110 21], ...
   'CallBack','sbswitch(''sptimport'')', ...
   'Style','edit', ...
   'Tag','edit3');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'HorizontalAlignment','left', ...
   'Position',[478 162 100 20], ...
   'String','Label1', ...
   'Style','text', ...
   'Tag','label3');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[312 162 36 20], ...
   'String','-->', ...
   'Tag','arrow3');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'BackgroundColor',[1 1 1], ...
   'HorizontalAlignment','left', ...
   'Position',[363 128 110 21], ...
   'CallBack','sbswitch(''sptimport'')', ...
   'Style','edit', ...
   'Tag','edit4');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'HorizontalAlignment','left', ...
   'Position',[478 128 100 20], ...
   'String','Label1', ...
   'Style','text', ...
   'Tag','label4');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[312 128 36 20], ...
   'String','-->', ...
   'Tag','arrow4');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'BackgroundColor',[1 1 1], ...
   'CallBack','sbswitch(''sptimport'')', ...
   'HorizontalAlignment','left', ...
   'Position',[363 63 210 21], ...
   'Style','edit', ...
   'Tag','editFs');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'HorizontalAlignment','left', ...
   'Position',[365 86 128 16], ...
   'String','Sampling Frequency', ...
   'Style','text', ...
   'Tag','labelFs');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'CallBack','sbswitch(''sptimport'')', ...
   'Position',[312 63 36 20], ...
   'String','-->', ...
   'Tag','arrow5');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'BackgroundColor',[1 1 1], ...
   'HorizontalAlignment','left', ...
   'Position',[363 12 209 21], ...
   'Style','edit', ...
   'Tag','editLabel');
ud = addToUserData(ud,b);
b = uicontrol('Parent',a, ...
   'units','pixels',...
   'HorizontalAlignment','left', ...
   'Position',[364 34 50 16], ...
   'String','Name', ...
   'Style','text', ...
   'Tag','labelLabel');
ud = addToUserData(ud,b);
set(a,'userdata',ud)


function udOutput = addToUserData(udInput,b)
%addToUserData - adds the handle b to input structure with the
%  field name given by b's tag
    udOutput = udInput;
    eval(['udOutput.h.' get(b,'tag') ' = b;'])
    
function minwidth(h,n)
%MINWIDTH Minimize width of centered text object to be just wide
% enough for extent.
% optional second argument specifies additional pixels on either side
% of text, defaults to 2

if nargin == 1
    n = 2;
end
for i=1:length(h)
    ex = get(h(i),'extent');
    pos = get(h(i),'position');
    switch get(h(i),'horizontalalignment')
    case 'center'
       set(h(i),'position',[pos(1)+pos(3)/2-ex(3)/2-n pos(2) ex(3)+2*n pos(4)])
    case 'left'
       set(h(i),'position',[pos(1)+n pos(2) ex(3)+2*n pos(4)])
       set(h(i),'horizontalalignment','center')
    end
end

function s = importHelpStr
% return cell array of strings which describes the import dialog

s = {
'IMPORTING DATA TO SPTOOL'
' '
'SOURCE   In this frame, click on "From Workspace" to import'
'data from the MATLAB workspace.  Click on "From Disk" to import'
'data from a MAT-file saved on disk.  With "From Disk" selected,'
'you can type a MAT-file name and hit enter, or click Browse to'
'look for a file on your computer.'
' '
'CONTENTS   If "From Workspace" is selected, this is a list'
'of the variables in the MATLAB workspace.  If "From Disk"'
'is selected, this is a list of the variables saved in the'
'MAT-file you entered.  To import data that has been previously'
'exported from the SPTool, just click on it here.'
' '
'ARROWS   Use an arrow button "-->" to move the selected'
'variable into the variable field to the right of the arrow.'
'You can also type variable names directly into these fields.'
'When "From Workspace" is selected, you can type in expressions'
'as well to create data or filters on the fly.'
' '
'IMPORT AS...   Select from this menu the type of data that'
'you wish to import. The fields underneath will change according'
'to the information needed to import the object.  For example, a'
'"Signal" object requires a Data field which is the signal data'
'vector or matrix, and a Sampling Frequency which is a scalar.'
' '
'NAME   Enter a name for your imported data here.  The SPTool'
'uses this name to keep track of your data.  The name must be'
'a legal MATLAB variable name, that is, it must begin with a'
'letter and then consist only of letters, numerals (0 through '
'9), and underscores "_".'
};
   
   
   
   

⌨️ 快捷键说明

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