Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Hi,
I'm using mBed as a processor to compute an equation and send back those arguments to MATLAB. So MATLAB reads from mBed those parameters passed on.
The coding done is shown below:-
#include <stdio.h> #include <iostream> #include <ctime> #include <cstdlib> #include <math.h> #include <time.h> #include "mbed.h" using namespace std; int main(){ srand( (unsigned)time( NULL ) ); double myarr[10]; int gen =0; double Ab1; double Ab2 ; int xmax = 2; int xmin = -2; int ymax = 2; int ymin = -2; while(gen < 300){ for(int i = 0; i < 10; i++) { myarr[i] = (double) rand()/(double) RAND_MAX; Ab1 = (xmax + myarr[i]*(xmin-xmax))/2; } printf("%.4f ",Ab1); for(int j = 0; j < 10; j++){ myarr[j] = (double) rand()/(double) RAND_MAX; Ab2 = (ymax + myarr[j]*(ymin-ymax))/2; } printf("%.4f ",Ab2); gen++; } getchar(); }I just want to send the Ab1 and Ab2 values to MATLAB where it this values will be plot out.