MATLAB visualization dynamic update | MATLAB | 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: 210
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: 210
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: 210
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. 

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
14 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

harriettlf60, ShaToow, Aleftinfenny, DiaBentee, hugo11dom@gmail.com, Pisaruk530

Administrators: Hans: 387, lee: 457