Memory Cell Insert cellarray

2 views (last 30 days)
Juan Rosado
Juan Rosado on 30 Jul 2012
Greetings,
My MATLAB program keeps giving me this error when I type a specific information to be outputed.
Basically, I take a web page, and divide the lines in text cell arrays to later take some specific lines to inform the user about weather conditions.
For example, three text array goes like this,
'<FONT SIZE=+1 COLOR="#800000">TONIGHT</FONT>'
'EAST NORTHEAST WINDS 13 TO 18 KNOTS. SEAS 4 TO 6 FEET.'
'SCATTERED SHOWERS. ISOLATED THUNDERSTORMS.'
I tell MATLAB to find all the lines starting with < B > (with 'find' comand and string comparison) and then take the following line and divide it in tokens (token = EAST NORTHEAST WINDS 13 TO 18 KNOTS. | remain = SEAS 4 TO 6 FEET. The period '.' is the delimiter)
The error goes in that some arrays the period end in the following line.
For instance,
'<FONT SIZE=+1 COLOR="#800000">TUESDAY NIGHT</FONT>'
'EAST SOUTHEAST WINDS 19 TO 24 KNOTS. SEAS 5 TO 6'
'FEET. SCATTERED SHOWERS AND ISOLATED THUNDERSTORMS.'
with remain = SEAS 5 TO 6 % 'FEET' moves to the next array
For the program to be viable, I need to have the whole information,
remain = 'SEAS 5 TO 6 FEET.'
I was thinking the problem might be in dividing the information using cell arrays, maybe another way of storing it would do.
Thank you for your time.
  1 Comment
Jan
Jan on 30 Jul 2012
I do not understand the title "Memory Cell Insert cellarray".

Sign in to comment.

Answers (1)

Jan
Jan on 30 Jul 2012
The following does not reveal the data type and dimensions:
text array goes like this,
'<FONT SIZE=+1 COLOR="#800000">TONIGHT</FONT>'
'EAST NORTHEAST WINDS 13 TO 18 KNOTS. SEAS 4 TO 6 FEET.'
'SCATTERED SHOWERS. ISOLATED THUNDERSTORMS.'
Is this a cell string, or a copy from the text file? Do the quote characters belong to the data or are they inserted by Matlab?
While I do not know the type of the input, I understood that you want to join the lines, such that a sentence, which is delimited by a dot, is not distributed over several lines (or cell strings, or whatever). Then this could be considered at the reading of the file (do not split at line breaks, but at '<B>' and '.'), or afterwards (join all lines between two '<B>'-lines).
As long as we see only a rough textual description of your input data and your program, it is hard and inefficient to give a more detailed suggestion. Please read Answers: How to ask a question again carefully.

Categories

Find more on Tables in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!