Fill 2d array with serial data from an arduino.

3 ビュー (過去 30 日間)
Mahindra Ganesh
Mahindra Ganesh 2020 年 10 月 16 日
編集済み: Prudhvi Peddagoni 2020 年 10 月 19 日
Hello everyone, i am having a difficult time trying to fill a 2d array with serial data from an arduino. At the moment i need help trying to construct a way to get data over serial from arduino to a matlab array.
My current program writes a char to my arduino, which sends back data. i am collecting 16 data points from a sensor; will have 16 sensors in all, so im looking for a way to asertain the 16 data points to fill a 2d 4x4 array, then move on to the next sensor and collect another 16 points of data and put it into a 4x4 array.
Any help with this will be GREATLY appreiciate. I pretty good with matlab and other languages, however nested loops however i've always had problems with :/. Thank you in advance for any help.

回答 (1 件)

Prudhvi Peddagoni
Prudhvi Peddagoni 2020 年 10 月 19 日
編集済み: Prudhvi Peddagoni 2020 年 10 月 19 日
Hi,
you can assign the array data you are getting from arduino to a 16X1 array and use reshape function to change it to 4X4 matrix.
A=reshape(A,[4 4]);
Hope this helps.

カテゴリ

Help Center および File ExchangeArduino Hardware についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by