Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Exporting MATLAB data in real time to Microsoft Excel 2007/2010

Subject: Exporting MATLAB data in real time to Microsoft Excel 2007/2010

From: Paolo

Date: 1 Feb, 2013 17:56:08

Message: 1 of 3

Hi,

I am trying to export some MATLAB data (which changes in real time through a bluetooth sensor) but I am having trouble with errors.

One method was to use ddeinit and ddepoke:

channel = ddeinit('excel','control.xls');

rc = ddepoke(channel, 'r1c1', mean(openmotion1));


However after 30 secs it would give me the following error message:

Error using ddepoke
The first argument 'channel' is not valid.

Error in btcallback (line 35)
rc = ddepoke(channel, 'r1c1', mean(openmotion1));

Error in instrcb (line 36)
        feval(val{1}, obj, eventStruct, val{2:end});

So instead, I try to use xlswrite but I am not sure how to export the data in real time using this function. Would I have to use ActiveX? And if so, could someone please enlighten me on how to do so?

Subject: Exporting MATLAB data in real time to Microsoft Excel 2007/2010

From: Ryan

Date: 27 Feb, 2013 17:35:13

Message: 2 of 3

I would hazard a guess that this goal is NOT attainable. As an Excel export, I can tell you that Excel is a great analytical tool, but it is NOT a real-time data management tool. Let's say you want to show real-time prices of all S&P components in Excel; you would need to send tremendous volumes of data to Excel and Excel would simply get overwhelmed very quickly. If you want to update your securities prices, let's say once per minute, that would be doable, and more practical. Is that what you want to do? If so, post back, and I'll help you get started with this task.

Regards,
Ryan--


"Paolo" wrote in message <kegvjo$crd$1@newscl01ah.mathworks.com>...
> Hi,
>
> I am trying to export some MATLAB data (which changes in real time through a bluetooth sensor) but I am having trouble with errors.
>
> One method was to use ddeinit and ddepoke:
>
> channel = ddeinit('excel','control.xls');
>
> rc = ddepoke(channel, 'r1c1', mean(openmotion1));
>
>
> However after 30 secs it would give me the following error message:
>
> Error using ddepoke
> The first argument 'channel' is not valid.
>
> Error in btcallback (line 35)
> rc = ddepoke(channel, 'r1c1', mean(openmotion1));
>
> Error in instrcb (line 36)
> feval(val{1}, obj, eventStruct, val{2:end});
>
> So instead, I try to use xlswrite but I am not sure how to export the data in real time using this function. Would I have to use ActiveX? And if so, could someone please enlighten me on how to do so?

Subject: Exporting MATLAB data in real time to Microsoft Excel 2007/2010

From: Yair Altman

Date: 28 Feb, 2013 07:14:09

Message: 3 of 3

"Paolo" wrote in message <kegvjo$crd$1@newscl01ah.mathworks.com>...
> Hi,
>
> I am trying to export some MATLAB data (which changes in real time through a bluetooth sensor) but I am having trouble with errors.
>
> One method was to use ddeinit and ddepoke:
>
> channel = ddeinit('excel','control.xls');
>
> rc = ddepoke(channel, 'r1c1', mean(openmotion1));
>
>
> However after 30 secs it would give me the following error message:
>
> Error using ddepoke
> The first argument 'channel' is not valid.
>
> Error in btcallback (line 35)
> rc = ddepoke(channel, 'r1c1', mean(openmotion1));
>
> Error in instrcb (line 36)
> feval(val{1}, obj, eventStruct, val{2:end});
>
> So instead, I try to use xlswrite but I am not sure how to export the data in real time using this function. Would I have to use ActiveX? And if so, could someone please enlighten me on how to do so?

xlswrite starts a dedicated Excel process each time it is invoked, so it is hardly performant. Instead, use xlswrite1 or officedoc from the File Exchange, both of which keep Excel open and communicate directly with it, which should be fast enough for your needs.

Related: http://undocumentedmatlab.com/blog/fixing-matlabs-actxserver/

Yair Altman
http://UndocumentedMatlab.com

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us