Home > . > cell2tab.m

# cell2tab

## PURPOSE

'cell2tab': transform a Matlab cell in a character array suitable for display in a table

## SYNOPSIS

function Tabchar=cell2tab(Tabcell,separator)

## DESCRIPTION

    'cell2tab': transform a Matlab cell in a character array suitable for display in a table
     INPUT:
     Tabcell: (nx,ny) cell table, for nx lines
     separator: character used for separating displayed columns

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- editxml 'editxml': function for editing xml files using a xml schema (associated with the GUI editxml.fig)
- geometry_calib 'geometry_calib': performs geometric calibration from a set of reference points
- get_field 'get_field': display variables and attributes from a Netcdf file, and plot selected fields
- plot_text 'plot_text': function for displaying the content of a Matlab structure in a figure
- probe_calib 'probe_calib': performs geometric calibration from a set of reference points
- uvmat 'uvmat': function associated with the GUI 'uvmat.fig' for images and data field visualization

## SOURCE CODE

    0001 %'cell2tab': transform a Matlab cell in a character array suitable for display in a table
    0002 % INPUT:
    0003 % Tabcell: (nx,ny) cell table, for nx lines
    0004 % separator: character used for separating displayed columns
    0005 function Tabchar=cell2tab(Tabcell,separator)
    0006 Tabchar={};%default
    0007 [nx,ny]=size(Tabcell);
    0008 %determine width withcolumn(jtab) of each column
    0009 for jtab=1:ny
    0010     widthcolumn(jtab)=0;%default
    0011     for itab=1:nx% read line
    0012         if widthcolumn(jtab)<length(Tabcell{itab,jtab})
    0013             widthcolumn(jtab)=length(Tabcell{itab,jtab});
    0014         end
    0015     end
    0016 end
    0017 %justify table
    0018 for itab=1:nx
    0019     charchain=[];
    0020     for jtab=1:ny% read line
    0021         textlu=Tabcell{itab,jtab};
    0022         if widthcolumn(jtab)>length(textlu)
    0023             blankstr=char(32*ones(1,widthcolumn(jtab)-length(textlu)));
    0024             textlu=[textlu blankstr];
    0025         end
    0026         if ~isempty(charchain)
    0027             textlu=[separator textlu];
    0028         end
    0029         charchain=[charchain textlu];
    0030     end
    0031     %Tabchar(itab)={charchain};
    0032     Tabchar(itab,1)={charchain};
    0033 end