Memory Cell Insert cellarray

조회 수: 1 (최근 30일)
Juan Rosado
Juan Rosado 2012년 7월 30일
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
Jan
Jan 2012년 7월 30일
I do not understand the title "Memory Cell Insert cellarray".

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2012년 7월 30일
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.

카테고리

Help CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by