Skip to content

Sending Matrix to Matlab #2

Description

@Gbouna

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions