help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

update & matrix2latex re: implementing num2cell


From: abl5
Subject: update & matrix2latex re: implementing num2cell
Date: Mon, 24 Oct 2005 16:14:30 -0400 (EDT)

On Mon, 24 Oct 2005, David Bateman wrote:
> address@hidden wrote:
>
> >Hi,
> >
> >I've been trying to get matrix2latex to work with Octave & found David
> >Bateman's num2cell -- but I'm running into problems with that.
<snip>
> Maybe if you replace "octave_idx_type" with "int" it might compile on
> 2.1.x though I haven't tried. Note the code is in C++ and must be
> compiled with "mkoctfile num2cell.cc" before being used..
>
> Regards
> David

David, Thanks, that worked! It's not a big change, but would it be helpful
if I sent you the modified .cc or .o file for the attic?

John, you were right about the .m vs .cc -- that was my mistake in naming
the file, since I realized that it was in some version of C but didn't
know to compile etc.

After compiling num2cell, I ran into a couple more errors/bugs (?) with
matrix2latex. Does anybody else use this in Octave? I've made it useable,
but I don't think that my attempts are really satisfactory for wide use.
The errors & my "fixes" are below in case anybody has comments or finds
them helpful.

The first error is from around line 48-49 and relates to the number of
variables. I commented it out because I couldn't defend it as necessary.
%    if (rem(nargin,2) == 1 || nargin < 2)
%        error('matrix2latex: ', 'Incorrect number of arguments to %s.',
mfilename)
%    end

The other errors relate to the code around line 124 (and 54-56) that
describe the alignment of the resulting Latex table. It doesn't seem to be
accepting a string as input for that variable. So I did two things:
a) commented out the error regarding the definition of alignment (56),
%                        warning('matrix2latex: ', 'Unkown alignment....

b) changed line 124 to get rid of the alignment option and set it to left
alignment:
(error messages:
error: invalid conversion from string to real N-d array
error: evaluating for command near line 124, column 5)
    if i=1:width
%% original: fprintf(fid, '%c|', alignment)
%%arwen's fix:
          fprintf(fid,'l|');
    end

There was some difficulty with the introduction of columnLabels as well,
which I haven't managed to fix, so it looks like something must not
be working with the use of strings in the array.

 Arwen



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]