an ND array of
- real and/or complex full numeric data
- real and/or complex sparse numeric data
- logical data
- char strings
- other objects
or an ND cell array of any combination of the above
to a 2D character array
- creates tables
- the input may be a cell array formatted as a table with
row/column labels and row/column separators
- any simple (ND) array can be formatted as a table using
any combination of
row/column labels and row/column separators
many options allow to format each aspect of the input and output
to better organize a project using CPRINTF
- options may be entered by an option structure
- options may be read from any ASCII file
- options may be saved in an executable m-file, which
returns an option structure
- the output may be saved in an ASCII file
- optionally, a file template may be used to insert the
result at a marked position
- tokens in a file template may be replaced by user defined
strings during runtime
CPRINTF may be a useful front end engine to create input for a spreadsheet program
> help cprintf
and the accompanying published M-file for more information and examples
to open the published M-file in a ML browser window
to run the examples used in the published M-file
Would you consider replacing this block (~ l.1050):
v=par.s2f('@(x) x'); % WARNING only
v(10); % ERROR to catch
for this one:
[msg_str_old, msg_id_old] = lastwarn('', '');
par.s2f('@(x) x'); % WARNING only
[msg_str, msg_id] = lastwarn(msg_str_old, msg_id_old);
if strcmp(msg_id, 'MATLAB:str2func:invalidFunctionName')
I'm asking because sometimes I have to run code using dbstop if caught error.
unfortunately, this is not possible...
you have to create the complete CELL in your loop and append it afterwards using the -fa option...
note: you could use the -Lc option to create the column labels at write-time...
So I looked at the part you mentioned and it doesn’t do what I want. I’m trying to avoid xlswrite because I have a mix of strings and numbers. Is there any way to make cprintf do the actual file output but without any spaces for padding?
I may well have missed that part. It’s a pretty long file and searching it for “tab” or “space” brings up a lot of hits. I’ll peruse that part. Thanks!
did you look at the last section in CPDOC(?)...
--- input to xlswrite
it shows how to use the content of
to create (for instance) excel data
This function is great for quickly and easily printing a cell array to a text file without worrying too much about format strings. But I can’t figure out how to prevent it from doing any padding with spaces. I’d like to output to a strictly tab-delimited file. I’ll probably be reading said file into excel or SPSS, so I don’t need the spaces for alignment, but I can’t figure out any way to leave them out entirely. (..., 'ntab', 1) isn’t doing it. Am I missing something, or is that functionality absent.
one of the most useful and definitely *the* best well made/structured/documented entry in the FEX
I quick question. If I create a column of numbers to reference the rows in my table, I would like to associate those numbers with a hyperlink. While I can perform this operation, the spacing/formatting of the column labels becomes quite ugly. Is there a simple solution?
By the way, I really enjoy using your function. It's great!
1) you show the input to FPRINTF; how do you call CPRINTF?
2) the error message indicates that some input values are not defined(?)
can you clarify?
I have tried cprintf on both release 7.5 and 7.8 but i get 'undefined function or variable...' I have tried to use fprintf but it disorganises the matrix
fprintf('Distance \t Path_loss \t Rx_Power \t SNR \n');fprintf('%f \t %f \t %f \t %f \n',K)
user request: added an option to change default TAB/SPACE replacement behavior in CELLs; version tag 11-Jun-2009 08:58:55
options now may be read from/saved to files and entered by option structures; more help on macros; version tag 01-Jun-2009 20:57:29
the other object conversion now uses a more versatile built-in engine; version tag 22-May-2009 12:27:24
added options to create/append results to ASCII files including use of template files; version tag 21-May-2009 21:58:49
improved handling of ND arrays and ND cell arrays of other objects; version tag 21-May-2009 15:20:31
speedup for ND logical arrays; version tag 18-May-2009 14:35:01
full support for ND structures; small change in page indexing engine; version tag 16-May-2009 02:57:29
extensive changes in handling of ND arrays and ND cell arrays of mixed content including optional page index display; version tag 13-May-2009 12:40:03
formatting changes in the HTML
added more explanatory text in the published M-file and corrected some annoying typos; no change in functionality; version tag: 21-Apr-2009 20:51:35
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.