MATLAB visualization dynamic update | MATLAB | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





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

Register Lost password?
sp_Feed sp_TopicIcon
MATLAB visualization dynamic update
Avatar
rayellam

Silver
Forum Posts: 11
sp_UserOfflineSmall Offline
1
August 24, 2017 - 6:28 am
sp_Permalink sp_Print

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

Avatar
cstapels

Gold
Forum Posts: 54
sp_UserOfflineSmall Offline
2
August 24, 2017 - 2:05 pm
sp_Permalink sp_Print

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.

Avatar
rayellam

Silver
Forum Posts: 11
sp_UserOfflineSmall Offline
3
September 8, 2017 - 4:58 am
sp_Permalink sp_Print

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

Avatar
cstapels

Gold
Forum Posts: 54
sp_UserOfflineSmall Offline
4
September 8, 2017 - 3:51 pm
sp_Permalink sp_Print

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.

Avatar
rayellam

Silver
Forum Posts: 11
sp_UserOfflineSmall Offline
5
September 9, 2017 - 3:00 am
sp_Permalink sp_Print

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

Avatar
cstapels

Gold
Forum Posts: 54
sp_UserOfflineSmall Offline
6
September 14, 2017 - 3:28 pm
sp_Permalink sp_Print

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. 

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online: alexparrado
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 250

Vinod: 142

piajola: 73

vespapierre: 63

Adarsh_Murthy: 59

cstapels: 54

Newest Members:

chrissaxon

getty

l3inbin

ossan

gbalychik

wul

Forum Stats:

Groups: 4

Forums: 17

Topics: 1242

Posts: 4315

 

Member Stats:

Guest Posters: 1

Members: 5546

Moderators: 0

Admins: 2

Administrators: Hans, lee