I attached data file. data is in format of
source _ip:source_port->destination_ip:destination_port
I want to take out only source_ip data from that, how to do.

2 comentarios

KSSV
KSSV el 23 de Nov. de 2016
No file attached..
Jay Hanuman
Jay Hanuman el 23 de Nov. de 2016
I forgot, now I attached

Iniciar sesión para comentar.

 Respuesta aceptada

KSSV
KSSV el 23 de Nov. de 2016
Editada: KSSV el 23 de Nov. de 2016

0 votos

load('n0 1.mat') ;
s = VarName6 ;
idx = strfind(s, ':');
idx = cell2mat(idx) ;
idx = idx(:,1)-1 ;
iwant = cellfun(@(x,idx) x(1:idx),s,num2cell(idx), 'UniformOutput', false) ;
Or
load('n0 1.mat') ;
s = VarName6 ;
s1 = regexp(s,':','split') ;
iwant = cellfun(@(x) x{1}(:)',s1, 'UniformOutput', false) ;

Más respuestas (1)

Walter Roberson
Walter Roberson el 23 de Nov. de 2016

0 votos

regexp() probably

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Nov. de 2016

Editada:

el 23 de Nov. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by