To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
The primary repository for this project is hosted at git://github.com/rmeddis/MAP.git .
This repository is a read-only copy which is updated automatically every hour.
root / utilities / UTIL_printTabTable.m @ 33:161913b595ae
History | View | Annotate | Download (551 Bytes)
| 1 |
function UTIL_printTabTable(M, headers, format) |
|---|---|
| 2 |
% printTabTable prints a matrix as a table with tabs |
| 3 |
%headers are optional |
| 4 |
%headers=strvcat('firstname', 'secondname')
|
| 5 |
% printTabTable([1 2; 3 4],strvcat('a1','a2'));
|
| 6 |
|
| 7 |
if nargin<3 |
| 8 |
format='%g'; |
| 9 |
end |
| 10 |
|
| 11 |
if nargin>1 |
| 12 |
[r c]=size(headers); |
| 13 |
for no=1:r |
| 14 |
fprintf('%s\t',headers(no,:))
|
| 15 |
end |
| 16 |
fprintf('\n')
|
| 17 |
end |
| 18 |
|
| 19 |
[r c]=size(M); |
| 20 |
|
| 21 |
for row=1:r |
| 22 |
for col=1:c |
| 23 |
fprintf('%s',num2str(M(row,col),format))
|
| 24 |
if col<c |
| 25 |
fprintf('\t')
|
| 26 |
end |
| 27 |
end |
| 28 |
fprintf('\n')
|
| 29 |
end |
| 30 |
|