MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Manuale Utente Pagina 80

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 408
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 79
2 Creating C Language MEX-Files
2-20
if(mxIsChar(tmp)) {
mxSetCell(fout, jstruct, mxDuplicateArray(tmp));
} else {
size_t sizebuf;
sizebuf = mxGetElementSize(tmp);
memcpy(pdata, mxGetData(tmp), sizebuf);
pdata += sizebuf;
}
}
/* Set each field in output structure */
mxSetFieldByNumber(plhs[0], 0, ifield, fout);
}
mxFree(classIDflags);
return;
}
To see how this program works, enter this structure.
friends(1).name = 'Jordan Robert';
friends(1).phone = 3386;
friends(2).name = 'Mary Smith';
friends(2).phone = 3912;
friends(3).name = 'Stacy Flora';
friends(3).phone = 3238;
friends(4).name = 'Harry Alpert';
friends(4).phone = 3077;
The results of this input are
phonebook(friends)
ans =
name: {1x4 cell }
phone: [3386 3912 3238 3077]
Vedere la pagina 79
1 2 ... 75 76 77 78 79 80 81 82 83 84 85 ... 407 408

Commenti su questo manuale

Nessun commento