Reading an Excel File (Excelfinlename.dvd) with decimal comma instaed of decimal point?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi..., Currently i am trying to read an excel files with two different ending . dvd & .sod (From SCADA system). i am using the [Values] = xlsread(File_to_Open) to do so. my question is: In the excel file i have the values so written (Example: 21,1) with comma not point (I am using a German Windows system) and when i am importing those data to matlab i am getting something like 37, I am not sure why!! Can you help me with this problem of importing when using the xlsread() function?
댓글 수: 2
채택된 답변
추가 답변 (1개)
per isakson
2013년 7월 31일
편집: per isakson
2013년 8월 1일
I don't recognize these extensions. I assume they are text.
Here are two files, which replace comma by dot. Pick one. Please, make copies of your files before you try these functions.
function fread_( strInFileSpec, strOutFileSpec )
fid = fopen( strInFileSpec, 'r' );
str = fread( fid, inf, '*char' );
fclose( fid );
str = strrep( str', '.', ',' );
fid = fopen( strOutFileSpec, 'w' );
fwrite( fid, str, 'char' );
fclose( fid );
end
function memmap_( strInFileSpec )
file = memmapfile( strInFileSpec, 'writable', true );
comma = uint8(',');
point = uint8('.');
file.Data(( file.Data==comma)' ) = point;
... delete(file)
end
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!