Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: read floating point from txt file and store in matrix
Date: Mon, 23 May 2011 09:39:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 36
Message-ID: <ird9vo$ptk$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1306143544 26548 172.30.248.45 (23 May 2011 09:39:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 23 May 2011 09:39:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2874280
Xref: news.mathworks.com comp.soft-sys.matlab:728208

i use the following codes to read the txt file
fid = fopen('x.txt','r');  
B=textscan(fid,'%f  ', 'delimiter',',');
C=cell2mat(B); 
fclose(fid);

this code give me this result

255
488
61.113
96.789
71.157
0
0
0
0
0
0
0
59.495
98.087
71.069
0
0
0
0


but i need when i arrive to end of line start to to save values in new row not to complete in the same coulmn as above
the shape of text  which i need command to store it in matrix as follow

255 (first  row)
488 (sec row)
61.1132,96.789,71.1566,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //end of line(third  row)
59.4945,98.0872,71.0687,0,0,0,0,0,0,0 (for  row)