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

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 408
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 365
8 Serial Port I/O
8-46
fopen(s)
4. Write and read data – Configure the scope to transfer the screen display as
a bitmap.
fprintf(s,'HARDCOPY:PORT RS232')
fprintf(s,'HARDCOPY:FORMAT BMP')
fprintf(s,'HARDCOPY START')
Wait until all the data is sent to the input buffer, and then transfer the data to
the MATLAB workspace as unsigned 8-bit integers.
out = fread(s,s.BytesAvailable,'uint8');
5. Disconnect and clean up – When you no longer need s, you should
disconnect it from the instrument, and remove it from memory and from the
MATLAB workspace.
fclose(s)
delete(s)
clear s
Viewing the Bitmap Data
To view the bitmap data, you should follow these steps:
1 Open a disk file.
2 Write the data to the disk file.
3 Close the disk file.
4 Read the data into MATLAB using the imread function.
5 Scale and display the data using the imagesc function.
Note that the file I/O versions of the
fopen, fwrite, and fclose functions are
used.
fid = fopen('test1.bmp','w');
fwrite(fid,out,'uint8');
fclose(fid)
a = imread('test1.bmp','bmp');
imagesc(a)
Vedere la pagina 365
1 2 ... 361 362 363 364 365 366 367 368 369 370 371 ... 407 408

Commenti su questo manuale

Nessun commento