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

Sending Matrix to Matlab #2

Open
Gbouna opened this issue Jun 25, 2020 · 0 comments
Open

Sending Matrix to Matlab #2

Gbouna opened this issue Jun 25, 2020 · 0 comments

Comments

@Gbouna
Copy link

Gbouna commented Jun 25, 2020

Thank for this library, it is really helpful for me.

However i have a concern, if i want to send the added value to Matlab, how do i go about it? Using the simple sample attached below as an example

#include <MatrixMath.h>
#define M  (4)
#define N  (3)
//int M = 4;
//int N = 3;
float A[M][N];
float C[M][N];
float B[M][N] = { 
  { 1, 1, 2}, 
  { 1, 1, 2},
  { 1, 1, 2},
  { 1, 1, 2}
  };

float s = 0;
void setup()
{
	Serial.begin(9600);
	}
void loop()
{
 // Initialize matrices
A[0][0] = 2;
A[0][1] = 2;
A[0][2] = 2;

A[1][0] = 2;
A[1][1] = 2;
A[1][2] = 2;

A[2][0] = 2;
A[2][1] = 2;
A[2][2] = 2;

A[3][0] = 2;
A[3][1] = 2;
A[3][2] = 2;

  for (int i = 0; i < M; i++)
  {
//    v[i] = i + 1;                  // vector of sequential numbers
    for (int j = 0; j < N; j++)
    {
s = A[i][j];

      }
    }


  Matrix.Add((float*) A, (float*) B, N, N, (float*) C);
  Serial.println("\nC = A+B (addition in-place)");
  Matrix.Print((float*)C, N, N, "C");
  Matrix.Print((float*)B, N, N, "B");

}

Thank you

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

No branches or pull requests

1 participant