Is there any function which returns the content of a variable as string?
    3 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Ray Lee
      
 am 14 Mär. 2016
  
    
    
    
    
    Beantwortet: Walter Roberson
      
      
 am 15 Mär. 2016
            We have to know the data type when using `sprintf` and it can convert limited types to string.
disp(var) can show the content of a variable of any type but it doesn't return anything.
0 Kommentare
Akzeptierte Antwort
  Walter Roberson
      
      
 am 15 Mär. 2016
        evalc(var)
or
evalc(disp(var))
The result will be a string that might well have newlines in it. Also note that if you have struct or cell array components, then strings or vectors that are more than a few characters might get summarized like '[1 x 17 double]'
0 Kommentare
Weitere Antworten (1)
  Fangjun Jiang
      
      
 am 14 Mär. 2016
        
      Bearbeitet: Fangjun Jiang
      
      
 am 14 Mär. 2016
  
      num2str();
mat2str()
1 Kommentar
Siehe auch
Kategorien
				Mehr zu Characters and Strings 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!


