Controlling MATLAB vis by URL/Querystring | 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
Controlling MATLAB vis by URL/Querystring
No permission to create posts
September 26, 2018
2:18 am
Avatar
ziplock9000

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

The old graphs can be manipulated via the URL querystring on a webpage or in an iFrame to show a certain number of data points, difference axis limits etc which is essential to be able to make a front end that is versitle. This will enable you click on a webpage and view the last 10 minutes, or the last 30 minutes or the last day, week etc.. or to make an arbitrary time duration. You can also change the scales and axis information.

With MATLAB visualisations how is any of this even possible when all of these parameters are hard coded into the code?

This means youd have to create code for every possible combination of how you'd like to manipulate the graph.. And totally impossible for an arbitrary one.

Just something like a textbox on a page when you can type a date range in would not work!

Is there any way to interface the querystring from a web request into the MATLAB vis code as variables?

Thanks.

September 27, 2018
7:09 am
Avatar
ziplock9000

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

So no way to pass parameters in from a URL request into the MATLAB vis like the hours parameter in the example below?

https://thingspeak.com/apps/matlab_visualizations/219572?hours=8

October 3, 2018
4:01 pm
Avatar
cstapels
Moderator
Members


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

There is the charts api:
https://www.mathworks.com/help/thingspeak/createchart.html

the charts API has several adjustable parameters, including days or min.

You could make the visualization read another channels last value to get parameters, or use the metadata fields. You would still need two commands, one to write the data and one to call the chart.

%%MATLAB Vis%%

%read channel
hours=thingSpeakRead(channelID, 'ReadKey','xxxxxxxxxxxxxxxx','numPoints',1)

[timeStamps, myData]=thingSpeakRead(otherChannelID,'ReadKey','YYYYYYYYYYYYYYYY','NumMinutes',hours*60);
plot(timestamps,myData);

October 4, 2018
5:44 am
Avatar
ziplock9000

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

Although very hacky, that should work. Thanks.

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
34 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:

Beverlytreta, MartaKah, genevievecu69, henriettapj1, scottok3, kqjkze

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457