Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: MATLAB: Parsing text from a file, and converting to a mathematical

$
0
0
On 12/2/2012 2:56 AM, Wuschelbeutel wrote:
> A .txt starts each line with a variable length string I don't care
> about, followed by space-delimited ID's that I want to store in an array V:
>
> somegarbage 34532 2034 203 4 30403
> garbage 2 45 2342 23 33503434
> ...
>
> All ID's on one line of the datafile should be
> 1. pushed into a mathematical set (i.e. {.} where order of the elements
> doesn't matter)
> 2. assigned to V[linenumber].
>
> What functions do I need? importdata('A.txt'); doesnt work because all
> the id's will be in one column.
>
> If MATLAB does not have a set data structure, is there anything that's
> close, or will I have to resort to two-dimensional arrays?

doc textscan % and friends

Read up on Matlab structures sounds as if what you're looking for...

<http://www.mathworks.com/help/matlab/data-types_data-types.html>

--

Viewing all articles
Browse latest Browse all 19628

Trending Articles