Home > cellorganizer > utilities > print2screen.m

print2screen

PURPOSE ^

PRINT2SCREEN Helper function that prints the contents of an array on the

SYNOPSIS ^

function print2screen( array )

DESCRIPTION ^

PRINT2SCREEN Helper function that prints the contents of an array on the
screen using MathML presentation format.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function print2screen( array )
0002 %PRINT2SCREEN Helper function that prints the contents of an array on the
0003 %screen using MathML presentation format.
0004 
0005 % Author: Ivan E. Cao-Berg (icaoberg@cmu.edu)
0006 % Created: May 8, 2007
0007 % Last Update: March 4, 2008
0008 %
0009 % Copyright (C) 2008 Center for Bioimage Informatics/Murphy Lab
0010 % Carnegie Mellon University
0011 %
0012 % This program is free software; you can redistribute it and/or modify
0013 % it under the terms of the GNU General Public License as published
0014 % by the Free Software Foundation; either version 2 of the License,
0015 % or (at your option) any later version.
0016 %
0017 % This program is distributed in the hope that it will be useful, but
0018 % WITHOUT ANY WARRANTY; without even the implied warranty of
0019 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0020 % General Public License for more details.
0021 %
0022 % You should have received a copy of the GNU General Public License
0023 % along with this program; if not, write to the Free Software
0024 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0025 % 02110-1301, USA.
0026 %
0027 % For additional information visit http://murphylab.web.cmu.edu or
0028 % send email to murphy@cmu.edu
0029 
0030 arraySize = size( array );
0031 
0032 % print a row vector
0033 if( arraySize(1) == 1 )
0034     disp( '<vector>' );
0035     for j=1:1:arraySize(2)
0036         disp( [ '<cn>' num2str(array(1,j)) '</cn>' ] );
0037     end
0038     disp( '</vector>' );
0039     % print a column vector
0040 elseif( arraySize(2) == 1 )
0041     disp( '<vector>' );
0042     for i=1:1:arraySize(1)
0043         disp( [ '<cn>' num2str(array(i,1)) '</cn>' ] );
0044     end
0045     disp( '</vector>' );
0046     % print an array
0047 else
0048     disp( '<array>' );
0049     for i=1:1:arraySize(1)
0050         disp( '<arrayrow>' );
0051         for j=1:1:arraySize(2)
0052             disp( [ '<cn>' num2str(array(i,j)) '</cn>' ] );
0053         end
0054         disp( '</arrayrow>' );
0055     end
0056     disp( '</array>' );
0057 end
0058 end%print2screen

Generated on Sun 29-Sep-2013 18:44:06 by m2html © 2005