Last change
on this file since 35 was
19,
checked in by gostiaux, 15 years ago
|
the private files have been moved down to the root folder
|
File size:
1.0 KB
|
Line | |
---|
1 | %'cell2tab': transform a Matlab cell in a character array suitable for display in a table
|
---|
2 | % INPUT:
|
---|
3 | % Tabcell: (nx,ny) cell table, for nx lines
|
---|
4 | % separator: character used for separating displayed columns
|
---|
5 | function Tabchar=cell2tab(Tabcell,separator)
|
---|
6 | Tabchar={};%default
|
---|
7 | [nx,ny]=size(Tabcell);
|
---|
8 | %determine width withcolumn(jtab) of each column
|
---|
9 | for jtab=1:ny
|
---|
10 | widthcolumn(jtab)=0;%default
|
---|
11 | for itab=1:nx% read line
|
---|
12 | if widthcolumn(jtab)<length(Tabcell{itab,jtab})
|
---|
13 | widthcolumn(jtab)=length(Tabcell{itab,jtab});
|
---|
14 | end
|
---|
15 | end
|
---|
16 | end
|
---|
17 | %justify table
|
---|
18 | for itab=1:nx
|
---|
19 | charchain=[];
|
---|
20 | for jtab=1:ny% read line
|
---|
21 | textlu=Tabcell{itab,jtab};
|
---|
22 | if widthcolumn(jtab)>length(textlu)
|
---|
23 | blankstr=char(32*ones(1,widthcolumn(jtab)-length(textlu)));
|
---|
24 | textlu=[textlu blankstr];
|
---|
25 | end
|
---|
26 | if ~isempty(charchain)
|
---|
27 | textlu=[separator textlu];
|
---|
28 | end
|
---|
29 | charchain=[charchain textlu];
|
---|
30 | end
|
---|
31 | %Tabchar(itab)={charchain};
|
---|
32 | Tabchar(itab,1)={charchain};
|
---|
33 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.