From: Eric Durant Subject: DDE to Access 2000: Lost Final Tuple Date: 03 Jul 2000 00:00:00 GMT Message-ID: <3960FD7B.625BAA7C@engin.umich.edu> Content-Transfer-Encoding: 7bit X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@eecs.umich.edu X-Trace: news.eecs.umich.edu 962657597 70323 141.213.6.23 (3 Jul 2000 20:53:17 GMT) Organization: EECS Dept. Univ. of Michigan Mime-Version: 1.0 Newsgroups: comp.soft-sys.matlab Matlab 5.3.1 seems to have problem parsing numeric data returned via DDE to Access 2000. When using the DDEREQ NUMERIC mode, it cannot see the last tuple in the relation. Using STRING mode returns the data properly. I first ran across this problem when using saved queries in an Access 2000 database. Below is example code to reproduce the bug. I've included a better commented/error-checking version of the code and a copy of the test MDB file in: http://www.edurant.com/software/ddeTest.zip The test MDB file just has a single table ('table1'), 2 float fields ('field1' and 'field2') and 2 tuples ((1,2),(3,4)). Is this a bug in Matlab's handling of numeric data, or is Access not returning the final tuple in NUMERIC mode? Does anyone know of a workaround, short of parsing the string data in one's own Matlab application? Thanks, Eric Durant %%%%%%%%%%%%%%%%%%%%%%%% controlchannel = ddeinit('MSAccess', 'System'); ddeexec(controlchannel, '[OpenDatabase e:\ddeTest.mdb]'); datachannel = ddeinit('MSAccess', 'ddeTest.mdb;SQL'); ddepoke(datachannel, 'SQLText', 'SELECT * FROM table1;'); dataNumeric = ddereq(datachannel, 'Data', [1 0]) dataString = ddereq(datachannel, 'Data', [1 1]) % dataNumeric gets only the first tuple as a Matlab double array: % [1 2] % dataString gets all the data as a Matlab char array: % 1\t2\n3\t4 ddeterm(datachannel); clear datachannel ddeexec(controlchannel, '[CloseDatabase]'); ddeterm(controlchannel); clear controlchannel %%%%%%%%%%%%%%%%%%%%%%%%