write a binary file from SQL-Server2005 and read it in Matlab
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Database Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!