Is it possible to use C++ string and sstream in MATLAB MEX?
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
Dear All,
Is it possible to use C++ string and sstream in a MATLAB MEX file? The following is a part of my code in which I am having problem:
string VariableNames;
ostringstream strout( VariableNames );
strout << "x y z "; 
for( int i = 0; i<N; i++)    
  strout << GetComponentName( i ) << " ";    
VariableNames = strout.str();
Although I have included string and sstream header files, MATLAB complains with the following error message:
 error C2065: 'string' : undeclared identifier
Could someone tell me if using C++ string is usable in MEX.
Thanks,
Ahmad
3 comentarios
  Kaustubha Govind
    
      
 el 19 de Feb. de 2013
				You probably also need to add "using namespace std;", and ensure that your MEX-file has a .cpp extension.
Respuestas (0)
Ver también
Categorías
				Más información sobre MATLAB Compiler en Help Center y File Exchange.
			
	Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!