Borrar filtros
Borrar filtros

String parsing and array of strings

1 visualización (últimos 30 días)
skyimager
skyimager el 30 de Mayo de 2012
The input data format is target$345$678$78$780$target. Noe the data format is constant but the number set is continuously changing. The first number set denotes temperature, the next pressure and so on. I want to store the first number set in an array called Temp(100)--Storing 100 sets of value, next number set in an array called Pressure(100). So parsing is required..each number set is to be stored in a different set of array.

Respuesta aceptada

TAB
TAB el 30 de Mayo de 2012
Inpt = 'target$345$678$78$780$target';
Str = strrep(Inpt,'target','');
Dcell = textscan(str(2:end),'%f','delimiter','$');
Temp(1) = Dcell{1}(1);
Pressure(1) = Dcell{1}(2);
.....and same for other values and other set of input string

Más respuestas (0)

Categorías

Más información sobre String Parsing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by