Hi, I have somae data in a byte format that i want to convert to double format. Does anyone know how to do this in matlab?
I have read the data in to a char, where every 8 characters should represent a double.
My data looks like this :
QAAAAAAAaIBAAAAAAADQgUAAAAAAAHCCQAAAAAAAsINAAAAAAAAohEAAAAAAAKCEQAAAAAAA4IVAAAAAAABgiEAAAAAAAJCKQAAAAAAAMItAAAAAAADQi0AAAAAAAGCNQAAAAAAAUI5A
/Malte

1 件のコメント

David Young
David Young 2012 年 1 月 9 日
Do you have any more information about how the numbers are coded? It's odd that there are only letters displayed, and there seem to be more than 8 characters per value judging from the periodicity. Showing the value of double(data), where data is your character string, might help.

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

 採用された回答

Malte
Malte 2012 年 1 月 10 日

0 投票

I found out that the string was in base64 code, which i have decoded using the base64decode function from: http://code.google.com/p/fieldtrip/source/browse/trunk/external/gifti/@gifti/private/base64decode.m?r=3261
I could then transform the uint8 array produced by base64decode with the typecast function.

その他の回答 (1 件)

Jan
Jan 2012 年 1 月 9 日

1 投票

Is there a good reason not to read the data in double format directly?
Usually typecast performs a binary conversion.

1 件のコメント

Geoffrey
Geoffrey 2025 年 4 月 9 日
The "typecast" function is useful for things like converting a string of bytes (stored as a uint8 vector for example) into other data types.

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

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

質問済み:

2012 年 1 月 9 日

コメント済み:

2025 年 4 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by