フィルターのクリア

write a binary file from SQL-Server2005 and read it in Matlab

1 回表示 (過去 30 日間)
Madhuresh
Madhuresh 2012 年 4 月 24 日
I can write binary data from Matlab and read it very easily. However, I'm facing problems while writing binary data from SQL Server 2005 (x64 machine, WinServer2003) and reading it in Matlab.
create table #temp (C1 int, C2 float,C3 float)
insert into #temp (C1,C2,C3) SELECT 1,2,3
insert into #temp (C1,C2,C3) SELECT 4,5,6
select convert(binary,C1),convert(binary,C2),convert(binary,C3)
from #temp
drop table #temp
-- This is output to a file: 'mydata.bin' with settings 'Save-->ANSI' (other option: Unicode)
I now try to read this data in Matlab:
fid = fopen('mydata.bin', 'r');
[Data, count] = fread(fid, [2,3], '??????=>double',0, 'a');
fclose(fid);
I get some weird output as 824707597, 539587368, ...... Shall appreciate your help! Thanks. I found the following links helpful: http://msdn.microsoft.com/en-us/library/ms187928.aspx, http://msdn.microsoft.com/en-us/library/ms187745.aspx

回答 (0 件)

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by