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

📄 open.m

📁 这是一个关于MATLAB的函数
💻 M
字号:
function dummy=open(cc,filename,filetype,timeout)
%OPEN Loads a file into the Code Composer Studio(tm) IDE.
%   OPEN(CC,FILENAME,FILETYPE,TIMEOUT) loads the specified FILENAME.
%   This file may include a full path description or just the name 
%   of the file if it resides in the Code Composer Studio working
%   directory.  Use the CC.CD method to view and modify the Code 
%   Composer working directory.  The FILETYPE parameter can override 
%   the default file extension definition. The following FILETYPE 
%   options are supported by this parameter:
%
%   'Text'      - Text file
%   'Workspace' - Code Composer workspace files
%   'Program'   - Target program file (executable)
%   'Project'   - Code Composer project files
%      
%   TIMEOUT defines an upper limit on the period this routine will wait
%   for completion of the specified file load.  If this period is 
%   exceeded, the routine will return immediately with a timeout error.
%   The action (open) may still occur for insufficient TIMEOUT values.
%   A timeout does not undo the 'open', it simply suspends waiting for
%   a confirmation.
%
%   OPEN(CC,FILENAME,FILETYPE) same as above, except the timeout is
%   replaced by the default timeout parameter from the CC object.
%
%   OPEN(CC,FILENAME)     or
%   OPEN(CC,FILENAME,[])  or
%   OPEN(CC,FILENAME,[],TIMEOUT) - same as above, except the file type
%   is derived from the file extension assocatied with the specified 
%   FILENAME.  File extensions are intrepreted as follows:
%
%   .wks - Code Composer workspace file
%   .out - Target program file (executable)
%   .pjt - Code Composer project file
%   (default) all other file extensions will be treated as text files.
%
%   Note, the program files (.out) and project files (.mak) are always
%   directed to the target DSP processor referenced by the CC object.  
%   However, workspace files are actively coupled to a specific target
%   DSP.  Consequently, the CC.OPEN method will load a workspace file 
%   in the Target processor that was active during the creation of the 
%   workspace file, which may NOT be the DSP processor referenced
%   by the CC object. 
%
%   See also CD, DIR, LOAD.

% Copyright 2001-2002 The MathWorks, Inc.
% $Revision: 1.21 $  $Date: 2002/06/12 15:30:35 $

error(nargchk(2,4,nargin));
if ~ishandle(cc),
    error('First Parameter must be a CCSDSP Handle.');
end

ofile = cc.fileparamparser(filename);
[fpath,fname,fext] = fileparts(filename);
if nargin <= 2,
    if strcmpi(fext,'.wks')
        filetype = 'workspace';
    elseif strcmpi(fext,'.out')
        filetype = 'program';
    elseif strcmpi(fext,'.pjt')
        filetype = 'project';
    else
        filetype = 'text';       % Default
    end
end

% Parse timeout
if( nargin >= 4) & (~isempty(timeout)),
    if ~isnumeric(timeout) | length(timeout) ~= 1,
        error('TIMEOUT parameter must be a single numeric value.');
    end
    dtimeout = double(timeout);
else
    dtimeout = double(get(cc,'timeout'));
end
if( dtimeout < 0)
    error(['Negative TIMEOUT value "' num2str(dtimeout) '" not permitted.']);
end

if ~ischar(filetype),
    error('File type parameter should be a char array.');
end

try
if strcmpi(filetype,'Workspace'),
    ccsmexswitchyard([4 cc.boardnum cc.procnum dtimeout cc.eventwaitms],ofile);
elseif strcmpi(filetype,'project'),
    ccsmexswitchyard([5 cc.boardnum cc.procnum dtimeout cc.eventwaitms],ofile);
elseif strcmpi(filetype,'program'),
    ccsmexswitchyard([6 cc.boardnum cc.procnum dtimeout cc.eventwaitms],ofile);
elseif strcmpi(filetype,'text'),
    ccsmexswitchyard([30 cc.boardnum cc.procnum dtimeout cc.eventwaitms],ofile);
else
    error(['FILETYPE ''' filetype ''' not recognized (expecting: ''workspace'',''project'' or ''program'').']);
end
catch
    if ~cc.isvisible,
        cc.visible(1);
    end
    error(lasterr);
end


% [EOF] open.m

⌨️ 快捷键说明

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