[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ERROR: memory exhausted -- trying to return prompt
From: |
Rosa Rudó Mauné |
Subject: |
Re: ERROR: memory exhausted -- trying to return prompt |
Date: |
Tue, 11 Apr 2006 15:50:05 +0200 |
I'm using Octaver version 2.1.42-athlonatlas with Windows XP.
In my file text, which is called "queries.mat.txt", I've got:
-first line (information): 6042 100247 894990
The first integer is the number of rows in the matrix, the second integer is the number of columns in the matrix and the third integer is the total of non-zeros of the matrix.
-other lines.
The (i+1) st line contains information about the non-zero entries of the i th row of the matrix.
The non-zero entries of each row are specified as a sparse-separated list of pairs. Each pair contains the column number followed by the value of that paricular column.
For example:
queries.mat.txt could be:
2 2 2
1 5 => (1,1) = 5
2 4 => (2,2) = 4
My aim is:
Saving the sparse matrix in a variable, because I'll need it, for doing operations.
My code is:
disp(fix(clock));
fid=fopen('queries.mat.txt');
tline=fgetl(fid);
capsalera=str2num(tline);
n=0;
while n <6042;
tline0 = fgetl(fid);
if tline0==-1
break;
endif
tline=str2num(tline0);
n=n+1;
matriulinea=[ones(length(tline)/2, 1) reshape(tline,2,length(tline)/2)'];
matriusparse=sparse(matriulinea(:,1), matriulinea(:,2), matriulinea(:,3),1,100247);
if n==1
matriuindexos=matriusparse;
else
matriuindexos=[matriuindexos; matriusparse];
endif
endwhile
matriuindexos=sparse(matriuindexos);
fclose(fid);
disp(fix(clock));
Rosa Rudó Mauné
On 4/11/06, David Bateman <address@hidden> wrote:
Rosa Rudó Mauné wrote:
> Hello,
>
> I want to create a sparse matrix from a file. The file has got 100247
> lines and 6042 columns. I read it line by line and I concatenate it,
> but when reaching line 73 the program stops and gives an error. The
> mistake is:
>
> ERROR: memory exhausted -- trying to return prompt
>
> Do you know how I can solve it?
>
> Rosa Rudó Mauné
More information please... What version of octave? What is the format of
the lines of code? What is the code you are using to read the file?
D.
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary