input data as a global
    4 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
I want to use the input data in my functions. I don't understand how to do that correctly. I declare uPtrs as a global before calling all functions, but Matlab is shutdown... Thanks for any answer :)
... 
InputRealPtrsType uPtrs = 0;  - !!!
void spinDisplay() 
{ 
spin = spin + 10*(*uPtrs[i]); - !!!
if (spin > 360.0) 
spin = spin - 360.0; 
glutPostRedisplay(); 
} 
static void mdlOutputs(SimStruct *S, int_T tid) 
{ 
real_T *y = ssGetOutputPortRealSignal(S,0); 
real_T *x = ssGetContStates(S); 
InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0); - !!!
int_T width = ssGetOutputPortWidth(S,0);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB); 
glutInitWindowSize (250, 250); 
glutInitWindowPosition (100, 100); 
glutCreateWindow ("hello"); 
init (); 
glutDisplayFunc(display); 
glutReshapeFunc(reshape); 
glutIdleFunc(spinDisplay); 
glutMainLoop(); 
}
0 commentaires
Réponses (0)
Voir également
Catégories
				En savoir plus sur Block and Blockset Authoring dans Help Center et File Exchange
			
	Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
