MATLAB COMPILER RELEASE NOTES Guía de usuario Pagina 651

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 716
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 650
Programming
22-21
% operate on data
outData = unicode2native(dataU);
fid = fopen(file, 'w');
fwrite(fid, outData, 'char');
fclose(fid);
Such a program would produce different and possibly incorrect results in V7.2 (R2006a).
The calls to native2unicode and unicode2native are no longer necessary, because
the fread and fwrite functions now convert data to and from MATLAB characters
using the character encoding scheme specified in the calls to fopen. In V7.2 (R2006a),
the example code can be simplified to produce correct results:
fid = fopen(file);
dataU = fread(fid, '*char')';
fclose(fid);
% operate on data
fid = fopen(file, 'w');
fwrite(fid, dataU, 'char');
fclose(fid);
Changes to code using fread, fgets, fgetl, and fscanf
If your code calls native2unicode to convert input to MATLAB characters using a
specified (or default) encoding scheme, you can, but do not have to, remove the calls to
native2unicode.
This applies to reading from an encoded file using any of the following:
fread with precision set to '*char' or 'char=>char'
fgets or fgetl
fscanf with the format specifier set to either '%s' or '%c'
When you remove a call to native2unicode, be sure that the call to fopen supplies the
same encoding argument (if any) as the call to native2unicode.
You may have used code like these examples in V7.1 (R14SP3):
indata = native2unicode(fread(fid, '*char')');
indata = native2unicode(fread(fid, 'char=>char')');
indata = native2unicode(fgets(fid));
indata = native2unicode(fgetl(fid));
indata = native2unicode(fscanf(fid, '%s'));
indata = native2unicode(fscanf(fid, '%c'));
Vista de pagina 650
1 2 ... 646 647 648 649 650 651 652 653 654 655 656 ... 715 716

Comentarios a estos manuales

Sin comentarios