help-octave
[Top][All Lists]
Advanced

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

Loading matrix of string and numbers


From: AlbFrigerio
Subject: Loading matrix of string and numbers
Date: Wed, 16 Feb 2011 00:15:24 -0800 (PST)

Hello world, I have a question about loading commands. I tried to look for
the answer in the forum but I didn't find it ; I believe someone already
made this question, but I cannot find the post :(

By the way, the question is quite simple: is it possible to load a matrix A
which consts of both string (first column) and numbers (second one), so that
A(i,1) returns a string and A(i,2) a number? See the attached file for a
simple (stupid) example.

http://octave.1599824.n4.nabble.com/file/n3308348/test.txt test.txt 

I tried to use [a,b]=textread("test.txt",'%s %d') , but I got a cell array
(a) and a vector (b) and, even it is a acceptable solution, it is not the
one I'd like: if I got a lot of columsn I should use [a,b,c,d, ... , goofy,
mickey, donald , ... , antares, betelgeus, aldebaran, ...] =
textread("test.txt",'%s %d %s ... ') , and it is not smart :)

Thanks everyone, hace a nice day!!

   Alberto
-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/Loading-matrix-of-string-and-numbers-tp3308348p3308348.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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