cancel
Showing results for 
Search instead for 
Did you mean: 

Impot Matrix

bmwael1
Associate II
Posted on October 21, 2013 at 16:33

Hello,

I want to import a Matrix which his size is 140*200 to my program.

This matrix is create by MATLAB (file format .mat) i can copy it to txt file.

How can i call in main program to be useful after ?

have I to separate the row and column by space or ;

I'm using STM32F4

Thanks you ^_^

#matrix #matlab #stm2f4 #size
3 REPLIES 3
Posted on October 21, 2013 at 17:01

I'd suggest you write a small C app, or script (AWK, Pearl, etc), and process that table into a ''C'' format that you can #include into your compilation.

int MyTable[10][10] = { { 1, 2, 3, .. }, .. , { .. } };

Alternatively if you have some file storage (SD Card, FatFs, NAND), you could store the text output from MatLab as a file, and simply parse that data into a structure/table at run time.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
bmwael1
Associate II
Posted on October 21, 2013 at 17:29

My table have a big size, i can't write it manually, i found a function called fopen but i didn't  know how to use it

some components of table are:

523 528 536 496 452 439 433 439  ............................. 200 column

250 658 025 ............................................

..................................

140 Row

Thanks

Posted on October 21, 2013 at 18:12

My table have a big size, i can't write it manually, i found a function called fopen but i didn't  know how to use it

Yeah, I'd class the app/script method as ''mechanical''. The STDIO and fopen/fread/fclose, and file handling concepts are pretty fundamental CS stuff.  Try this, or Google for some others.

http://www.cs.bu.edu/teaching/c/file-io/intro/

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..