how to read a string
    12 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    john_arle
 am 17 Okt. 2019
  
    
    
    
    
    Beantwortet: Guillaume
      
      
 am 17 Okt. 2019
            hello there, 
I am very tired and I would need to read a string like this
tline = 'CHTRS95 46.521464753 6.567893633 460.487'
tline is a char, I want to put the first word in a string and the three numbers in a double. 
All using this function: 
sscanf(tline, ' %f %f')
 (it is somehow wrong, 
I get :"
Unable to perform assignment because the size of the left side is 1-by-2 and the
size of the right side is 0-by-0
.")
0 Kommentare
Akzeptierte Antwort
  Guillaume
      
      
 am 17 Okt. 2019
        split = textscan(tline, '%s%f%f%f');
txt = split{1}
numbers = cell2mat(split(2:end))
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu String Parsing finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
