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

📄 shrink.html

📁 mri_toolbox是一个工具用来MRI. 来自于SourceForge, 我上传这个软件,希望能结识对医疗软件感兴趣的兄弟.
💻 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 shrink</title>  <meta name="keywords" content="shrink">  <meta name="description" content="SHRINK - Removes outer zeros of a matrix.">  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  <meta name="generator" content="m2html &copy; 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> &gt;  <a href="index.html">mri_toolbox</a> &gt; shrink.m</div><!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td><td align="right"><a href="index.html">Index for mri_toolbox&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>shrink</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>SHRINK - Removes outer zeros of a matrix.</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 [Y, varargout] = shrink(X,E) </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"> SHRINK - Removes outer zeros of a matrix.

   Y = SHRINK(X) removes the outer columns/rows/etc (borders) that
   contains only zeros on a matrix X. The shrinking goes on untill
   the first column/row/etc containing a nonzero element is found

   Examples: SHRINK([0 0 1 0 2 3 0]) = [1 0 2 3]

             SHRINK([[0 0 0 0 0 0 0]  = [[0 0 1 2]
                      0 0 0 1 2 0 0]     [0 0 0 0]
                      0 0 0 0 0 0 0]     [3 0 0 0]]
                      0 3 0 0 0 0 0]])

  Y = SHRINK(X,E) removes columns/rows/etc containing only the 
  element E, intead of zero.

  [Y,Li,Ls] = SHRINK(...) also returns the limits of the shrinking,
  Li = inferior limits and Ls = superior limits.

    See also <a href="grow.html" class="code" title="function Y = grow(varargin)">GROW</a>, ROLL, PAD, PADC.</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)"></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 [Y, varargout] = shrink(X,E)</a>0002 0003 <span class="comment">% SHRINK - Removes outer zeros of a matrix.</span>0004 <span class="comment">%</span>0005 <span class="comment">%   Y = SHRINK(X) removes the outer columns/rows/etc (borders) that</span>0006 <span class="comment">%   contains only zeros on a matrix X. The shrinking goes on untill</span>0007 <span class="comment">%   the first column/row/etc containing a nonzero element is found</span>0008 <span class="comment">%</span>0009 <span class="comment">%   Examples: SHRINK([0 0 1 0 2 3 0]) = [1 0 2 3]</span>0010 <span class="comment">%</span>0011 <span class="comment">%             SHRINK([[0 0 0 0 0 0 0]  = [[0 0 1 2]</span>0012 <span class="comment">%                      0 0 0 1 2 0 0]     [0 0 0 0]</span>0013 <span class="comment">%                      0 0 0 0 0 0 0]     [3 0 0 0]]</span>0014 <span class="comment">%                      0 3 0 0 0 0 0]])</span>0015 <span class="comment">%</span>0016 <span class="comment">%  Y = SHRINK(X,E) removes columns/rows/etc containing only the</span>0017 <span class="comment">%  element E, intead of zero.</span>0018 <span class="comment">%</span>0019 <span class="comment">%  [Y,Li,Ls] = SHRINK(...) also returns the limits of the shrinking,</span>0020 <span class="comment">%  Li = inferior limits and Ls = superior limits.</span>0021 <span class="comment">%</span>0022 <span class="comment">%    See also GROW, ROLL, PAD, PADC.</span>0023 <span class="comment">%</span>0024 0025 <span class="keyword">if</span> nargin==10026    E = 0;0027 <span class="keyword">end</span>0028 0029 <span class="comment">% If X is row vector transform to col vector (to prevent problems with find)</span>0030 flagrow = 0;0031 <span class="keyword">if</span> ndims(X)==2 &amp; size(X,1)==1 &amp; size(X,2)&gt;=10032    X = X';0033    flagrow = 1;0034 <span class="keyword">end</span>0035 0036 <span class="comment">% Finding columns/rows/etc to be extracted</span>0037 c = ind2subm( size(X), find(X~=E) );0038 0039 <span class="comment">% Get minimuns and maximuns founds</span>0040 li = min(c,[],1)';0041 ls = max(c,[],1)';0042 0043 <span class="comment">% Mounting text: li(1):ls(1),li(2):ls(2)...</span>0044 N = ndims(X);0045 <span class="keyword">for</span> i = 1 : N0046    ind{i} = li(i):ls(i);0047 <span class="keyword">end</span>0048 0049 <span class="comment">% Making Y</span>0050 Y = X(ind{:});0051 0052 <span class="comment">% De-transposing is X is row vector</span>0053 <span class="keyword">if</span> flagrow0054    Y = Y';0055 <span class="keyword">end</span>0056 <span class="keyword">if</span> nargout&gt;10057    varargout{1} = li';0058    varargout{2} = ls';0059 <span class="keyword">end</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> &copy; 2003</address></body></html>

⌨️ 快捷键说明

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