Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need saveMtx function for Matlab #3

Closed
bklare-zz opened this issue Jan 10, 2013 · 7 comments
Closed

Need saveMtx function for Matlab #3

bklare-zz opened this issue Jan 10, 2013 · 7 comments
Assignees

Comments

@bklare-zz
Copy link
Contributor

Similar to the loadMtx file, a saveMtx file needs to be added to allow Matlab users to save similarity matrices for analysis in openbr.

@ghost ghost assigned bklare-zz Jan 10, 2013
@jklontz
Copy link
Member

jklontz commented Jan 10, 2013

Sounds good. I think the approach should be to extend $br -convert to allow conversion to/from the other supported matrix formats (.mtx, .csv). Sounds like Matlab also uses the .mtx extension for a binary matrix? Is there another extension we could use to distinguish between the current .mtx format and the matlab format? Like .mat?

@jklontz
Copy link
Member

jklontz commented Jan 10, 2013

Actually, step 0 should be to add it to plugins/format.cpp. See csvFormat for an example.

@bklare-zz
Copy link
Contributor Author

I think the approach should be to extend $br -convert to allow conversion to/from the other supported matrix formats (.mtx, .csv).

Agreed.

Sounds like Matlab also uses the .mtx extension for a binary matrix? Is there another extension we could use to distinguish between the current .mtx format and the matlab format? Like .mat?

Matlab files to store binaries of objects (e.g., a matrix) have a default extension of .mat (so, good guess). The file structure is at the link below. I am not sure if there already exists a Qt-based implementation of this this format. If not, we should definitely code it into a -convert command.

In the meantime we can use the matlab functions loadMat() and saveMat() for a weaker amount of matlab support.

http://www.mathworks.com/help/pdf_doc/matlab/matfile_format.pdf

@jklontz
Copy link
Member

jklontz commented Jan 15, 2013

Matlab matrices are now first class citizens in OpenBR. The newly added formats are .mat (as described in matfile_format.pdf) and .bin (simple binary format).

You can use br -convert input_file output_file to convert to/from matricies with any of the following formats:

  • .bin
  • .csv
  • .mat
  • .mask
  • .mtx
  • .jpg/.png/...

This should obviate the need for loadMat() and saveMat().

Relevant code is in sdk/plugins/format.cpp

@jklontz jklontz closed this as completed Jan 15, 2013
@bklare-zz
Copy link
Contributor Author

Bravo sir! Looks very elegant too!

@bklare-zz
Copy link
Contributor Author

An update on how to use this command: br -convert Format input_file output_file

@jklontz
Copy link
Member

jklontz commented Aug 6, 2013

for example:
br -convert Format myScores.mtx myScores.mat
or
br -convert Gallery myTemplates.gal myTemplateMetadata.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants