#include "mex.h"

void timestwo_alt(double *y, double x) {
*y = 2.0*x; }

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
	double *y;
	double x;
	/*Crea una matrice 1x1 per l'argomento di ritorno*/
	plhs[0]=mxCreateDoubleMatrix(1,1,mxREAL);
	/*Prende il valore scalare per l'input x*/
	/*Nota: mxGetScalar ritorna un valore, non un puntatore-*/
	x=mxGetScalar(prhs[0]);
	/*Assegna un puntatore all'output.*/
	y = mxGetPr(plhs[0]);
	/*Chiama la subrutine timestwo_alt.*/
	timestwo_alt(y,x);
	}
	
	