[Index for tmp_for_tar/dumper]
[Return to Master Index]
any2str
(tmp_for_tar/dumper/any2str.m)
Function Synopsis
s = any2str(mat)
Help text
s = any2str(thing) - Convert an octave object to a string
thing : an octave object (matrix, list or struct)
s : string : string that evaluates to thing
See also any2m, cmpany, list2str, mat2str, struct2str, str2str.
Last modified: August 2001
Listing of function file tmp_for_tar/dumper/any2str.m
## s = any2str(thing) - Convert an octave object to a string
##
## thing : an octave object (matrix, list or struct)
##
## s : string : string that evaluates to thing
##
## See also any2m, cmpany, list2str, mat2str, struct2str, str2str.
## Author: Etienne Grossmann <etienne@isr.ist.utl.pt>
## Last modified: August 2001
function s = any2str(mat)
# cl = class(mat);
if is_matrix(mat) || any(size(mat)==0),
s = mat2str(mat) ;
elseif isstr(mat),
# mat2 = strrep(mat,'''','''''');
## mat2 = strrep(mat,"'","\'");
## mat2 = mat ;
## q = [ split('\\\'"\a\b\f\n\r\t\v','')' ; '\\\'"abfnrtv' ] ;
## for i=1:size(q,2) , mat2 = strrep (mat2,q(1,i),['\\',q(2,i)]) ; end
## mat2 = strrep(mat2,"\n","\\n");
## s = sprintf('\'%s\'',mat2);
s = str2str (mat);
elseif is_list(mat),
s = list2str(mat);
elseif is_struct(mat),
s = struct2str(mat);
else
printf("Sorry, any2str doesn't know how to stringify \n") ;
keyboard
end
Produced by oct2html on Tue Aug 7 17:33:07 2001
Cross-Directory links are: ON