#583 Implicit Type Conversion

v4.0 (major)
closed-invalid
nobody
5
2013-03-31
2013-03-08
RM Nair
No

The csv file read has 4 cols. So uint8 is okay.

However, if the number of rows exceed 256, only 256 rows are read.

If the type for ColNum is changed to uint16, all rows are read.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ColNum = cast(str2num(getline('Col Number To Plot?')), 'uint8');

tmp = csvread(CSV_FileName);

NoOfRows = numel(tmp)/4;

CSV_ColData = csvread(CSV_FileName, 00 , ColNum, [00, ColNum, NoOfRows, ColNum]);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Discussion

  • RM Nair
    RM Nair
    2013-03-08

     
    Attachments
  • Samit Basu
    Samit Basu
    2013-03-31

    • status: open --> closed-invalid
     
  • Samit Basu
    Samit Basu
    2013-03-31

    Hi,

    I believe the behavior (although bizarre) is correct. In Matlab, if you have an array with multiple types, the smallest type dominates the resulting array (so an array with a single entry that is uint8 will be all uint8 type). FreeMat uses the same so as to not break existing Matlab codes.

    Samit