📄 mri_toolbox_recent.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><html><head> <title>Description of mri_toolbox_recent</title> <meta name="keywords" content="mri_toolbox_recent"> <meta name="description" content="mri_toolbox_recent - Keep track of mri_toolbox .mat files"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="m2html © 2003 Guillaume Flandin"> <meta name="robots" content="index, follow"> <link type="text/css" rel="stylesheet" href="../m2html.css"></head><body><a name="_top"></a><div><a href="../index.html">Home</a> > <a href="index.html">mri_toolbox</a> > mri_toolbox_recent.m</div><!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td><td align="right"><a href="index.html">Index for mri_toolbox <img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>mri_toolbox_recent</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>mri_toolbox_recent - Keep track of mri_toolbox .mat files</strong></div><h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>function [ files, varargout ] = mri_toolbox_recent(filename,command); </strong></div><h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre class="comment"> mri_toolbox_recent - Keep track of mri_toolbox .mat files
Useage: [files,mri] = mri_toolbox_recent([filename],[command])
filename = path & filename of an mri_toolbox .mat file to
be added to the recent files list
command = 'load', to load one of the recent files
'clear', to clear all recent files
If filename is not given, the function returns
the most recent files saved (if any). If it
is given, the filename is added to the list.
If the load command is given, filename.mat is
loaded and the mri struct is returned. Otherwise
the mri struct is empty.
Tracks recent mri structure saves to .mat files
for the mri_toolbox gui. The return variable
'files' is a cell array of strings containing
the filesystem location of recent mri files saved.
The recent files list is limited to 20.</pre></div><!-- crossreference --><h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>This function calls:<ul style="list-style-image:url(../matlabicon.gif)"></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="mri_toolbox.html" class="code" title="function [ varargout ] = mri_toolbox(command)">mri_toolbox</a> mri_toolbox - Graphical user interface (GUI) to various MRI tools</li><li><a href="mri_toolbox_defaults.html" class="code" title="function [mri] = mri_toolbox_defaults(command,mri);">mri_toolbox_defaults</a> mri_toolbox_defaults - Create, read, write mri_toolbox defaults</li></ul><!-- crossreference --><h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [ files, varargout ] = mri_toolbox_recent(filename,command);</a>0002 0003 <span class="comment">% mri_toolbox_recent - Keep track of mri_toolbox .mat files</span>0004 <span class="comment">%</span>0005 <span class="comment">% Useage: [files,mri] = mri_toolbox_recent([filename],[command])</span>0006 <span class="comment">%</span>0007 <span class="comment">% filename = path & filename of an mri_toolbox .mat file to</span>0008 <span class="comment">% be added to the recent files list</span>0009 <span class="comment">% command = 'load', to load one of the recent files</span>0010 <span class="comment">% 'clear', to clear all recent files</span>0011 <span class="comment">%</span>0012 <span class="comment">% If filename is not given, the function returns</span>0013 <span class="comment">% the most recent files saved (if any). If it</span>0014 <span class="comment">% is given, the filename is added to the list.</span>0015 <span class="comment">%</span>0016 <span class="comment">% If the load command is given, filename.mat is</span>0017 <span class="comment">% loaded and the mri struct is returned. Otherwise</span>0018 <span class="comment">% the mri struct is empty.</span>0019 <span class="comment">%</span>0020 <span class="comment">% Tracks recent mri structure saves to .mat files</span>0021 <span class="comment">% for the mri_toolbox gui. The return variable</span>0022 <span class="comment">% 'files' is a cell array of strings containing</span>0023 <span class="comment">% the filesystem location of recent mri files saved.</span>0024 <span class="comment">%</span>0025 <span class="comment">% The recent files list is limited to 20.</span>0026 <span class="comment">%</span>0027 0028 <span class="comment">% $Revision: 1.2 $ $Date: 2004/02/07 01:41:51 $</span>0029 0030 <span class="comment">% Licence: GNU GPL, no express or implied warranties</span>0031 <span class="comment">% Created: 07/2003 Darren.Weber_at_radiology.ucsf.edu</span>0032 <span class="comment">%</span>0033 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0034 0035 0036 LIMIT = 20;0037 0038 <span class="keyword">if</span> ~exist(<span class="string">'filename'</span>,<span class="string">'var'</span>),0039 filename = <span class="string">''</span>;0040 <span class="keyword">elseif</span> isempty(filename),0041 filename = <span class="string">''</span>;0042 <span class="keyword">end</span>0043 <span class="keyword">if</span> ~exist(<span class="string">'command'</span>,<span class="string">'var'</span>),0044 command = <span class="string">''</span>;0045 <span class="keyword">elseif</span> isempty(command),0046 command = <span class="string">''</span>;0047 <span class="keyword">end</span>0048 0049 0050 <span class="comment">% -- locate the installation path and the recent file list</span>0051 0052 path = fileparts(which(<span class="string">'mri_toolbox_recent'</span>));0053 <span class="keyword">if</span> isempty(path),0054 msg = sprintf(<span class="string">'Cannot find mri_toolbox on the matlab path.\n\nPlease use the addpath command.\n\n'</span>);0055 error(msg);0056 <span class="keyword">else</span>0057 path = strcat(path,filesep);0058 <span class="keyword">end</span>0059 0060 0061 <span class="comment">% -- load the recent 'files' cell array</span>0062 0063 recentfile = strcat(path,<span class="string">'mri_toolbox_recent.mat'</span>);0064 <span class="keyword">if</span> exist(recentfile) == 2,0065 load(recentfile);0066 <span class="keyword">else</span>0067 files = cell(1);0068 <span class="keyword">end</span>0069 0070 0071 <span class="comment">% -- add a new file to the 'files' array</span>0072 0073 <span class="keyword">if</span> ~isempty(filename),0074 <span class="keyword">if</span> isempty(files{1}),0075 files{1} = filename;0076 <span class="keyword">else</span>0077 <span class="comment">% should check to see if already in list</span>0078 <span class="comment">% if so, rearrange the list</span>0079 0080 i = strmatch(filename,char(files),<span class="string">'exact'</span>);0081 <span class="keyword">if</span> ~isempty(i),0082 <span class="comment">% remove it from current list</span>0083 <span class="keyword">if</span> isequal(i,1), files = files(2:end);0084 <span class="keyword">elseif</span> isequal(i,LIMIT), files = files(1:end-1);0085 <span class="keyword">else</span> files = files([1:i-1 i+1:end]);0086 <span class="keyword">end</span>0087 <span class="keyword">end</span>0088 files = fliplr(files); <span class="comment">% put most recent at end, for now</span>0089 files{end+1} = filename; <span class="comment">% add filename to end</span>0090 files = fliplr(files); <span class="comment">% now put most recent at beginning</span>0091 0092 <span class="keyword">end</span>0093 0094 <span class="comment">% only keep 'LIMIT' most recent</span>0095 <span class="keyword">if</span> size(files,2) > LIMIT,0096 files = files(1:LIMIT);0097 <span class="keyword">end</span>0098 0099 save(recentfile,<span class="string">'files'</span>);0100 <span class="keyword">end</span>0101 0102 0103 <span class="keyword">switch</span> command,0104 <span class="keyword">case</span> <span class="string">'load'</span>,0105 <span class="keyword">if</span> ~isempty(filename),0106 mri = [];0107 load(filename);0108 <span class="keyword">end</span>0109 <span class="keyword">case</span> <span class="string">'clear'</span>,0110 files = cell(1);0111 save(recentfile,<span class="string">'files'</span>);0112 <span class="keyword">otherwise</span>,0113 <span class="keyword">end</span>0114 0115 0116 0117 <span class="keyword">if</span> (nargout > 1) & exist(<span class="string">'mri'</span>,<span class="string">'var'</span>),0118 <span class="keyword">if</span> ~isempty(p),0119 varargout{1} = mri;0120 <span class="keyword">end</span>0121 <span class="keyword">end</span>0122 0123 0124 0125 <span class="keyword">return</span></pre></div><hr><address>Generated on Fri 21-May-2004 12:38:21 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -