필터 지우기
필터 지우기

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 CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by