Hello, I was wondering if anyone could tell me how to send live data from Excel to Matlab. I have a program running in Excel that graphs live data from an Arduino Uno, now I just need to send that data into Matlab in real-time. What's the command for that? Do I need an infinite loop?

8 commentaires

Walter Roberson
Walter Roberson le 9 Juin 2015
Merged from duplicate question:
"I have a program running that takes acceleration data from an Arduino Uno and puts it into Microsoft Excel. I downloaded Spreadsheet Link Ex for Excel so that I could send data directly into Matlab from Excel. It works great, I can send data once it has been obtained very easily, but I was wondering if there is a way to send data in real-time to Matlab from Excel using the Spreadsheet Link Ex."
Walter Roberson
Walter Roberson le 9 Juin 2015
If you can operate Excel in somewhat real-time then you can have it call those MATLAB functions in somewhat real-time. How to operate Excel in somewhat real-time is beyond the scope of a MATLAB forum.
Michael Morotto
Michael Morotto le 9 Juin 2015
I can already operate Excel in real-time using a program I downloaded. I just need to know how to send the data I am receiving into Matlab in real-time, using a Matlab add-in (Spreadsheet Link Ex). I don't believe this is beyond the scope of a Matlab forum.
Walter Roberson
Walter Roberson le 9 Juin 2015
Modifié(e) : Walter Roberson le 9 Juin 2015
Whatever you do to operate Excel in real-time, have it invoke the formula you built that gathers the data and calls out to MATLAB with it. The items built by Builder EX become calls that can appear in formula in Excel, invoked by any mechanism that can invoke an Excel formula.
Are you putting the data into Excel by using a COM object? If so then you an use the COM object to invoke the formula or cell.
Hiskiel Stephanus
Hiskiel Stephanus le 9 Juin 2015
Hi You can try the "xlswrite" command in MATLAB and specify the excel file where the data is going to be saved. This may have to be in a loop. Thus you can dynamically allocate space in the Excel file.
I hope this solves your problem.
Michael Morotto
Michael Morotto le 9 Juin 2015
@Walter Roberson, yes I am using a COM port to get the data into Excel. Thank you for your response, I'm going to do a bit more research into it and I'll let you all know if I figure it out.
@Hiskiel Stephanus I originally thought about using the "xlswrite" command, but I figured the file had to be saved before using that, and I'm unsure if I could call the data using such a command if it's still being updated in real-time, i.e. not being saved.
Image Analyst
Image Analyst le 9 Juin 2015
Michael, you could have your MATLAB code running that will set up an ActiveX connection to the workbook. It can periodically check the workbook for new data and haul it over when new data is found. Like you keep track of the last row of data, then every 1 second (or whatever) check the row one below that and see if it's no longer empty. If there's something there, then grab all the new numbers and haul them over, and then update the last row number that is being used.
Michael Morotto
Michael Morotto le 11 Juin 2015
@Image Analyst That sounds like exactly what I need to do. Do you know of any examples I could draw some inspiration from. I'm not very experienced with Matlab. Thank you for your time.

Connectez-vous pour commenter.

Catégories

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by