Re: Number to vectors



someone wrote:
"adam " <unique.pq@xxxxxxxxx> wrote in message <hbi7h5$1n3$1@xxxxxxxxxxxxxxxxxx>...
Both your version would work, thanks
But I still got the problem because my number has got a lot of digits (I'm talking of like a million digits).

What I got is a txt file with a lot 0 and 1 but there is no spacing between them and I need to seperate them.
If I create a MATLAB variable with it it deletes a lot of digites as the variable cannot hold so many digits...

Is there any other way to do it? Maybe not in MATLAB but somewhere else? I tried MS Word Replace all and just add a , after every 1 and 0 but as it's 163 pages full of digits it hangs...

Anyone got an idea?

% Without knowng more about the file format, try:

doc fread
doc fgetl
doc textscan

% Look at the Examples and see if any apply to your problem.
% Also look at the See Also section for other ideas.

More than likely fgetl won't help as I'd presume there are no linefeeds.

Something otoo

fid=fopen(filename,'rt');
while ~feof(fid)
s = fread(fid, 1024)';
v = [v double(char(s-'0'))];
end

The above will need several details including the last partial buffer assuming not multiple of the (assumed) 1024 and preallocating v to avoid the runtime overhead therein.

But, the idea is to slurp up a piece of the file at a time as characters, and convert to double a character at a time.

If memory really is a problem, instead of concatenating, write out the digits to a binary file (or text w/ delimiters or whatever is wanted/needed) so it can be processed however later.

In that case, of course, one will undoubtedly need to be able to do the processing piecemeal as well.

W/ no more information than given, what is needed is back into the crystal ball region and mine is _still_ in the shop... :(

--

Will
.



Relevant Pages

  • Re: Date Format Problem - mm.yy
    ... access to make the year out of the last 2 digits, ... I'm with Brenden on how to avoid this issue, ... too hard to make sense of a bunch of characters. ... There are a bunch of other issues involving the delimiter ...
    (microsoft.public.access.formscoding)
  • Re: Paper & pencil password algorithm
    ... currently I am using a 10x10 Polybius square. ... How would you convert base 11 digits to base 10 digits with uniform ... characters to find on the keyboard. ... I'm undecided on whether it should be 2 or 3 foldsums. ...
    (sci.crypt)
  • Re: Question for the math wizards...
    ... string of characters that isn't too long, ... bits per character with base-32 encoding, then we are limited to shipping ... to know if it was possible given m to map m via a function Fto an m' ... In real world terms, say n is 100 digits, m is 50 digits, and I want to ...
    (sci.crypt)
  • Re: Invariant with DIGIT-CHAR-P and the reader.
    ... should appear to the Lisp reader as a number. ... >> reading of the standard makes me believe the Lisp reader should ... > Why a new CL could not accept more forms for unicode digits? ... a..z, characters chosen by the implementation, and not from some higher ...
    (comp.lang.lisp)
  • Re: Can Explorer sort order be adjusted?
    ... separate numbers, and the strings are sorted first by first-number, ... Then sorting is by the rest of the character string, ... folder so they know how many digits to use in the numbering, ... The KB article that I gave said the numeric characters are treated as ...
    (microsoft.public.windowsxp.general)