help-octave
[Top][All Lists]
Advanced

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

Re: parsing system call output


From: Carlo de Falco
Subject: Re: parsing system call output
Date: Thu, 27 Aug 2009 22:37:48 +0200


On 27 Aug 2009, at 21:58, Derek Tsui wrote:

Hi, does anyone know of a function or way to parse the output returned from a system call? I am using system to query mysql db.

Example
[status, output] = system ("mysql -u root -N -e 'SELECT * FROM t' ");

disp(output) would return something like
0       10      1021    5       11      1       1
0       10      1021    5       15      1       1
0       10      1021    5       16      1       1

But if I do size(output) it is [1 x] , one dimensional.

I am trying to parse output and put the values into a matrix. Could anyone help?

the output of system is a string, if it reprsents a matrix of numbers like in the example above you can convert it
by simply doing

[status, output] = system ("mysql -u root -N -e 'SELECT * FROM t' ");
output = str2num (output);

Thanks,
Derek
c.


reply via email to

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