Giter VIP home page Giter VIP logo

tinymat's Introduction

TinyMAT

A (partly templated) C++ library to handle writing simple Matlab(r) MAT file in Version "MATLAB 5.0" or higher

This library implements a very simple interface to write Matlab MAT file (level 5), as described in http://www.mathworks.de/help/pdf_doc/matlab/matfile_format.pdf

It is licensed under the terms of the GNU Lesser general Public license (LGPL) >=2.1

Language Lates Release Documentation

CI: Windows Build CI: Documentation/Linux/MacOX Build

Code Quality Code Grade

Example

The following example code writes some arrays and matrices into a MAT-file:

TinyMATWriterFile* mat=TinyMATWriter_open("test.mat");
if (mat) {
	// a 3D matrix in row-major
	double mat432[4*3*2]= {
	    1,2,3,
		4,5,6,

		10,20,30,
		40,50,60,

		100,200,300,
		400,500,600,

		1000,2000,3000,
		4000,5000,6000,
	};
	int32_t mat432_size[3] = {3,2,4}; // columns, rows, matrices,...

	// a struct as a map of doubles
	std::map<std::string, double> mp1;
	mp1["x"]=100;
	mp1["y"]=200;
	mp1["z"]=300;
	mp1["longname"]=10000*M_PI;

	TinyMATWriter_writeStruct(mat, "struct1", mp1);
	TinyMATWriter_writeMatrixND_rowmajor(mat, "matrix432", mat432, mat432_size, 3);

	TinyMATWriter_close(mat);
}

Library Bindings

Documentation

tinymat's People

Contributors

jkriege2 avatar songyuncen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tinymat's Issues

Failed to include TinyMAT as a CMake project

CMake Error at MyProject/3rdparty/TinyMAT/src/CMakeLists.txt:161 (configure_file):
configure_file Problem configuring file.

The directory of the "readme.txt.in" written in line 161 of the CMakeLists.txt is ${CMAKE_SOURCE_DIR} which is my project's top-level directory. I think the CMAKE_SOURCE_DIR should probably be replaced with PROJECT_SOURCE_DIR.

Makefile:209: recipe for target 'libTinyMAT_basic_test' failed

Hi...
I want to build your library, but it gets me this error:

Scanning dependencies of target TinyMAT
[ 25%] Building CXX object src/CMakeFiles/TinyMAT.dir/tinymatwriter.cpp.obj
[ 50%] Linking CXX static library libTinyMAT_Release.a
[ 50%] Built target TinyMAT
Scanning dependencies of target libTinyMAT_basic_test
mingw32-make.exe[3]: ***. Stop.
mingw32-make.exe[3]:
[ 75%] Building CXX object examples/basic_test/CMakeFiles/libTinyMAT_basic_test.dir/test_tinymat.cpp.obj
mingw32-make.exe[2]: *** [examples/basic_test/CMakeFiles/libTinyMAT_basic_test.dir/all] Error 2
mingw32-make.exe[1]: *** [examples/basic_test/CMakeFiles/libTinyMAT_basic_test.dir/rule] Error 2
mingw32-make.exe: *** [libTinyMAT_basic_test] Error 2
CMakeFiles\Makefile2:249: recipe for target 'examples/basic_test/CMakeFiles/libTinyMAT_basic_test.dir/all' failed
CMakeFiles\Makefile2:256: recipe for target 'examples/basic_test/CMakeFiles/libTinyMAT_basic_test.dir/rule' failed
Makefile:209: recipe for target 'libTinyMAT_basic_test' failed

I using MinGW and add qt5 & opencv by -DQt5_DIR & -DOpenCV_DIR. It builds on Linux like a charm but I can't build it on Windows!

TinyMATWriter_writeStringVector inside of TinyMATWriter_startStruct doesn't work

I'm trying to write a vector of strings to a MATLAB structure using the following pseudo code:

TinyMATWriter_startStruct(...)
TinyMATWriter_writeStringVector(...)
TinyMATWriter_endStruct(...);

The code compiles and runs fine but when I try to open the resulting .mat file in MATLAB I get the following error: "Cannot read file test.mat"

If I move TinyMATWriter_writeStringVector(...) outside of the structure everything works fine. Any idea what I might be doing wrong?

complex data

Hi

Thank you for sharing this super useful tool with community.
Is there any plan for supporting complex data?
Thank you.

Ali

How to create a 1xN structure?

Hello everyone.
I would like to create a struct with size 1xN.

For example:
field1 field2
A 1
B 2
C 3
D 4
... ....

Which TinyMAt functions (or combination of them) can I use ?

MutiChannels Issue

inline void TinyMATWriter_writeMultiChannelMatrix2D_rowmajor(TinyMATWriterFile* mat, const char* name, const T* data_real, int32_t cols, int32_t rows, uint32_t c) {

template<typename T>
inline void TinyMATWriter_writeMultiChannelMatrix2D_rowmajor(TinyMATWriterFile* mat, const char* name, const T* data_real,  int32_t cols, int32_t rows, uint32_t c) {
  int32_t dims[2]={rows, cols}; //?? should be : int32_t dims[2]={cols, rows}; ?
  TinyMATWriter_writeMultiChannelMatrix2D_rowmajor(mat, name, data_real, dims, 2, c);
//?? should be : TinyMATWriter_writeMultiChannelMatrixND_rowmajor(mat, name, data_real, dims, 2, c); ?
}

It's an awesome library, I haven't delved into it yet, I'm going to use this lib to write RGB24 data, I think there is something wrong with this function, but I'm not sure.

2GB file limit

Hi,
first of, thanks for sharing your lib, works well so far with one exception.

Do you have an idea how to work around the 2GB file limit or does it work on your end?
I tried to use _fseeki64 and _ftelli64 without success.

I am building on Windows 10 64bit using mingw-64.

Best regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.