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 件のコメント
Aubai
Aubai 2013 年 7 月 31 日
Any suggestion will be welcomed :)
Jan
Jan 2013 年 7 月 31 日
I've enabled the decimal dot on my German system to avoid such troubles.

サインインしてコメントする。

採用された回答

Aubai
Aubai 2013 年 8 月 1 日
it seems i had the solution all along. I took the third output of xlsread and then change it from cell to matrix using cell2mat and i got me wished output thx for the help anyway :)

その他の回答 (1 件)

per isakson
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
  3 件のコメント
per isakson
per isakson 2013 年 8 月 1 日
Neither .dvd nor .sod is included in this list: File formats that are supported in Excel
Aubai
Aubai 2013 年 8 月 5 日
Thx for the help this type of Format is generated by ENERCON SCADA system. I am actually becoming no problems using Excel to open those files. my final soluation was to use the third output of the xlsread() function which gives the opend file as Cell array (without any changes) and then re-change it to numbers for example by using cell2mat. thx again for ur help

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by