Is it possible to load a .mat file in Arduino Ide?

HI. :slight_smile:
I had trained a neural network using Matlab script, so, I got the .mat file.
Is it possible for me to load the network into Arduino 1.8.10 for real-time application? I couldn't find any related solution or website. If you have any idea on this, please comment, I'm appreciate about that!

No.

Files for Arduino programs must be written in C or C++

...R

You can export the matrices to CSV files, and then include them in your C++ code.

double data[] = {
#include "data.csv"
};
1.1, 2.2, 3.3

This also works for multi-dimensional data, but you have to make sure that there are trailing commas at the end of each line in the CSV file.

double data[2][3] = {
#include "data.csv"
};

void setup() {
    Serial.begin(115200);
    for (const auto &row : data) {
        for (const auto &el : row)
            Serial.print(el), Serial.print(' ');
        Serial.println();
    }
}
1.1, 1.2, 1.3,
2.1, 2.2, 2.3

Pieter