How to access induvidual elements in a string

I have a many strings of format "xhrs ymin".
where x and y are numbers
i want to store x and y in separate integers.
how do i do it?

1 comentario

madhan ravi
madhan ravi el 15 de Jun. de 2019
Is your array datetime? If yes look into hms()

Respuestas (1)

Stephen23
Stephen23 el 15 de Jun. de 2019
The simplest and most efficient solution is to use sscanf:
>> S = '23hrs 45min';
>> V = sscanf(S,'%fhrs%fmin')
V =
23
45

La pregunta está cerrada.

Preguntada:

el 15 de Jun. de 2019

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by