필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Finding specific phrases within a cell array

조회 수: 1 (최근 30일)
Juan Rosado
Juan Rosado 2012년 7월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
Greetings,
I am working with a total of nine(9) text strings within nine(9) cell ( {9x1} )
and I am trying to take specific sentences of the text strings.
For example, one text string says:
EAST WINDS 15 TO 20 KNOTS. SEAS 4 TO 6 FEET.
I am trying to divide these two sentences in two structured variables under the name Today.
Today.Winds = EAST WINDS 15 TO 20 KNOTS
Today.Waves = SEAS 4 TO 6 FEET
I was thinking of telling MATLAB to break when he reaches the first dot and imprint the string as Today.wind, then continue till the next dot, break and imprint it as Today.waves.
How can I do this?
Thank you for your time.
  댓글 수: 2
Jan
Jan 2012년 7월 15일
How do you want to store the output for the 9 different strings? Struct array or as scalar struct, which contains cell strings? E.g. the ninth one: Today(9).Winds or Today.Winds{9}.
Juan Rosado
Juan Rosado 2012년 7월 15일
The 9 different strings represents the 7 days of the week, plus today and night forecast, resulting in 9 different strings
The output would go like this:
Today.Winds = EAST WINDS 15 TO 20 KNOTS
Today.Waves = SEAS 4 TO 6 FEET
Tonight.Winds = bla bla bla KNOTS
Tonight.Waves = bla bla bla FEET
Monday.Winds = bla bla bla KNOTS
Monday.Waves = bla bla bla FEET
Tuesday.Winds = bla bla bla KNOTS
etc...

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by