https://github.com/bmc-labs/matiopp
C++ wrapper for matio - Read Only (for now)
https://github.com/bmc-labs/matiopp
cpp library matio
Last synced: 3 months ago
JSON representation
C++ wrapper for matio - Read Only (for now)
- Host: GitHub
- URL: https://github.com/bmc-labs/matiopp
- Owner: bmc-labs
- License: apache-2.0
- Created: 2019-07-18T14:27:05.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-14T20:15:24.000Z (over 5 years ago)
- Last Synced: 2025-01-16T08:42:18.809Z (4 months ago)
- Topics: cpp, library, matio
- Language: Objective-C
- Homepage:
- Size: 1.72 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
`matiopp`
---... is a thin, header-only C++ wrapper for matio..
Main features
==- modern C++ semantics implemented: all the allocation and freeing of memory
happens via constructor and smart pointers
- uses `boost.regex` to filter for channels/columns/vectors/whatever you want
to call them
- uses exceptions to gracefully handle things
- is really drop-in and use; makes you feel like C++ is Python (except thanks
to `matio` you can use one solution for all versions of mat files)Usage
==
Have a look at the tests, ideally, but it's all meant to work as simple as:```c++
//
// create bmc::mat object
//
bmc::mat my_data{filename /* std::string */, channel_regex /* std::string */};auto no_of_channels = my_data.number_of_channels();
auto temp_sensor = my_data.at("temp_sensor"); // or my_data["temp_sensor"]
for (const auto & it : my_data) {
// do something with the channel
}if (my_data.find("pressure") != my_data.end()) {
std::cout << "pressure column found" << '\n';
}auto size_of_columns = my_data.size();
if (my_data.empty()) {
std::cout << "no data found in file" << '\n';
}
```The regex string is optional; you can leave it empty to just load everything.
Data is returned as `std::vector`.
Making it part of you project
==
There are two ways to do this. Option A is: clone the repo, copy [the
header](include/matiopp.h) to your project and include it. That's probably the
easiest thing to to if you're not using CMake.If you are using CMake, I recommend you clone the repo to your thirdparty
directory or whereever you want it to live and add the following to your
CMakeList files:```cmake
add_subdirectory (${YourProject_SOURCE_DIR}/path/to/matiopp)add_exectuable (your_executable your_sources.cc) # or library
target_link_libraries (your_executable matiopp::matiopp) # or PRIVATE etc
```That's it. Have fun.