Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Mathematics
General TopicsResearchOperations ResearchStatisticsMathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Math
Math Software
MapleMathematicaMATLABScilabSASSPSS

Math Forum / Math Software / MATLAB / July 2008



Tip: Looking for answers? Try searching our database.

How to read a text to Cell ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Zheyu.Gao@googlemail.com - 24 Jul 2008 19:43 GMT
hi, eveyone, I got a problem transfering a txt file to cell array, the
problem as following
-----------------------------------------------
mask.txt
-----------------------------------------------
3x3 4x4 5x5   //mask definitions can vary

1 2 3
4 5 6
7 8 9

1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4

1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
------------------------------------------------------
how do I convert this to a cell which
C{1,1}=3x3
C{1,2}=4x4
C{1,3}=5x5

I tried textscan but the format field is fixed, in my situation,
format is variable depend on the 1st line of the text file.

can anyone give some help please!!
Scott Burnside - 24 Jul 2008 21:12 GMT
Zheyu.Gao@googlemail.com wrote in message <cad24a09-3de7-
49e1-9d73-818edf449288@q28g2000prh.googlegroups.com>...
> hi, eveyone, I got a problem transfering a txt file to cell array, the
> problem as following
[quoted text clipped - 27 lines]
>
> can anyone give some help please!!

help cellstr
Zheyu.Gao@googlemail.com - 24 Jul 2008 21:41 GMT
> Zheyu....@googlemail.com wrote in message <cad24a09-3de7-
>
[quoted text clipped - 38 lines]
>
> - Show quoted text -

thanks for the help, but cellstr dose not seems to solve the problem,
I want the array in the each cell to be 3x3 int for example

c{1,1}=<3x3 int>
c{1,2}=<4x4 int>
is there a way to do it? or can textscan have a dynamic format? for
example
'%d'  3 times or N times.
Zheyu.Gao@googlemail.com - 24 Jul 2008 23:09 GMT
> Zheyu....@googlemail.com wrote in message <cad24a09-3de7-
>
[quoted text clipped - 38 lines]
>
> - Show quoted text -

Hi Scott
thanks for your help, I have solve the problem, just ignore my
previous post. cheers man.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.