From hansonbt at gmail.com Fri Jul 24 20:58:24 2009 From: hansonbt at gmail.com (bhanson) Date: Fri, 24 Jul 2009 16:58:24 -0400 Subject: Reading individual variables from .mat file Message-ID: <442f3f200907241358x75eb1587g3594a97f5c7ce1c5@mail.gmail.com> I have a Matlab .mat file and am attempting to read multiple variables (or specify individual variables from a file containing multiple variables). However, using the examples under "Matlab IO" documentation I am only able to retrieve one variable (always the same one). Any ideas? Also, when attempting to use the 'iterator interface' example in the documentation, I get the following error... erminate called after throwing an instance of 'std::runtime_error' what(): Matlab_view_header(read): Unsupported data_element type: got miCOMPRESSED (15), can only handl miMATRIX (14) Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From brooks at codesourcery.com Sat Jul 25 00:06:58 2009 From: brooks at codesourcery.com (Brooks Moses) Date: Fri, 24 Jul 2009 17:06:58 -0700 Subject: [vsipl++] Reading individual variables from .mat file In-Reply-To: <442f3f200907241358x75eb1587g3594a97f5c7ce1c5@mail.gmail.com> References: <442f3f200907241358x75eb1587g3594a97f5c7ce1c5@mail.gmail.com> Message-ID: <4A6A4CA2.8080808@codesourcery.com> Hello! bhanson wrote, at 7/24/2009 1:58 PM: > I have a Matlab .mat file and am attempting to read multiple variables (or > specify individual variables from a file containing multiple variables). > However, using the examples under "Matlab IO" documentation I am only able > to retrieve one variable (always the same one). Any ideas? Perhaps a better example to follow for Matlab IO with multiple variables in a single file is the example in the testsuite, contained in tests/vsip_csl/matlab/matlab_bin_file/matlab_bin_file.cpp. For reference, I've attached a copy. When you first use operator>> on your std::ifstream object with a Matlab_bin_formatter object, you will always retrieve the first variable in the file. If you then use it again on the same std::ifstream object (without closing and reopening the file), you'll get the second variable, and so forth. The "name" argument is not used to locate the variable within the file -- its purpose was only as a check to make sure that the loaded variable corresponds to the programmer's expectations. > Also, when attempting to use the 'iterator interface' example in the > documentation, I get the following error... > > erminate called after throwing an instance of 'std::runtime_error' > what(): Matlab_view_header(read): Unsupported data_element type: got > miCOMPRESSED (15), can only handl miMATRIX (14) Unfortunately, there are some known bugs with the Matlab-file iterator interface, and it is currently not working. Thanks, - Brooks -- Brooks Moses CodeSourcery brooks at codesourcery.com -------------- next part -------------- A non-text attachment was scrubbed... Name: matlab_bin_file.cpp Type: text/x-c++src Size: 9507 bytes Desc: not available URL: