MATLAB visualization dynamic update | MATLAB IoT Analytics | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
MATLAB visualization dynamic update
No permission to create posts
August 24, 2017
6:28 am
Avatar
rayellam

Silver
Members
Forum Posts: 11
Member Since:
April 2, 2015
sp_UserOfflineSmall Offline

Hi All,

Im using the following code in MATLAB visualization to display some text of a field value in a public view. The problem is it does not dynamically update. How do i achieve that? 

Code...................................................

FlowLh = thingSpeakRead(xxxxxxxx,'Field',1);

FlowLh = FlowLh/1000

annotation('textbox',[0.2 0.2 0.6 0.6],...

'HorizontalAlignment','center',...

'VerticalAlignment','middle',...

'LineStyle','none',...

'String',[num2str(FlowLh) ' m3'],...

'FontSize',48);

 

Thanks

Ray

August 24, 2017
2:05 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Ray,

The MATLAB code will only run when you tell it to.

I would suggest setting a TimeControl to update your value on a regular schedule, or you could set up a React to change every time the channel value changes.

September 8, 2017
4:58 am
Avatar
rayellam

Silver
Members
Forum Posts: 11
Member Since:
April 2, 2015
sp_UserOfflineSmall Offline

Hi,

Thanks for the reply but it seems that time and react controls will only work with MATLAB Analysis and NOT with visualization. If im correct then this seems like a major draw back? Can anyone confirm this is the case as my MATLAB experience is very limited.

 

I am using this NON ELEGANT work around to refresh the public view, below. Edit your public channel ID and refresh time then save as an html file. Then run this file.

<html lang="en">
<body style="margin:0;padding:0">

</body>

var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
var frameHdl = document.getElementById('myIFrame');
frameHdl.src = "https://thingspeak.com/channels/YOUR CHANNEL NUMBER HERE"
frameHdl.height = height;
frameHdl.width = width;
window.setInterval("reloadPage();", 1*60*1000); //minutes to milliseconds
function reloadPage() {
location.reload(true);
}

</html>

 

TIA
Ray

September 8, 2017
3:51 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

I assume there is some data tht you are posting to a channel that you want to reference somewhere else.  If that is incorrect, can you provide more info on what is your final goal?

Use a react or timeControl to trigger MATLAB analysis that writes data to a field. Use thingSpeakWrite() in your MATLAB analysis for example.  Then when you read that field, 

If your data is numeric and you can display it in a plot, you can use the to embed your plot in a page (raw html)  and set the plot to dynamic with a refresh rate where you want it. See embed a plot.  'update' is the time in seconds to refresh the plot.

September 9, 2017
3:00 am
Avatar
rayellam

Silver
Members
Forum Posts: 11
Member Since:
April 2, 2015
sp_UserOfflineSmall Offline

Here is a link to my Public channel.
https://thingspeak.com/channels/311730

The problems are associated with the middle two iFrames that are both MATLAB visualizations and the data for these comes from channels that are updated once per minute. The problem is both these iFrames DO NOT dynamically update when new channel values are received as the rest of the thingspeak iframes do, instead i have to manually refresh the whole screen using F5 keyboard key to view the new data.

So my question is how do i assign a dynamic update to MATLAB visualizations?

Thanks again
Ray

September 14, 2017
3:28 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Ray,

At present, it is not possible to have the visualizations update automatically in the same way thingSpeak plots update.  This may be considered as a possible upgrade in the future.  You may also consider using the plugins app.  Another possibility to consider would be to embed the <iframe> for your visualization in a different page that has an automatic refresh built in, but the rate available to you may be limited. 

September 20, 2018
7:32 pm
Avatar
ziplock9000

Gold
Members
Forum Posts: 21
Member Since:
September 12, 2018
sp_UserOfflineSmall Offline

"At present, it is not possible to have the visualizations update automatically in the same way thingSpeak plots update" Is this still the case because I've not been able to Google a way to do this?

September 21, 2018
9:00 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

As of Sept 21, it is still the case that visualizations will not automatically re-evaluate their code. The work around listed will still work, and we are considering changes based on this feedback from users.

June 3, 2020
6:27 am
Avatar
Momo
New Member
Members
Forum Posts: 1
Member Since:
June 3, 2020
sp_UserOfflineSmall Offline

I know this has been asked before, but as of June 2020, is it possible to update Matlab Visualizations automatically or no?

June 3, 2020
7:10 pm
Avatar
Vinod

MathWorks
Members
Forum Posts: 339
Member Since:
May 1, 2016
sp_UserOfflineSmall Offline

This is possible by enabling a checkbox that becomes available if you have a paid ThingSpeak license.

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
9 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

khanhNguyen_CT, susyburr, quijano__, meosuckhoe, briskpanda, Dejw0089

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457