Use of "thingSpeakWrite" command from Matlab | General | 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
Use of "thingSpeakWrite" command from Matlab
Avatar
Hondo
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
1
May 15, 2017 - 6:54 am
sp_Permalink sp_Print

Dear all,

if I using the "thingsSpeakWrite" command, I always get the error message "Undefined variable "matlab" or class "matlab.net.URI"Yell
Do I need an additional package/toolbox?

Avatar
Adarsh_Murthy

Forum Posts: 59
sp_UserOfflineSmall Offline
2
May 15, 2017 - 4:49 pm
sp_Permalink sp_Print

Hi, 

Thanks for reporting this issue. ThingSpeakWrite does not require any additional packages or toolboxes other than ThingSpeak Support Toolbox.

To help us investigate this issue further, could you tell us what version of MATLAB you are using? Also, what OS are you using? 

 

-Adarsh

Avatar
Hondo
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
3
May 16, 2017 - 3:12 am
sp_Permalink sp_Print

Hi Adarsh,

thank for your fast reply.
The output of the command "ver" entered in the command window is as follows:

-----------------------------------------------------------------------------------------------------------------------------------------------------

MATLAB Version: 9.1.0.441655 (R2016b)
MATLAB License Number: 841745
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 14393)
Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB                                                Version 9.1         (R2016b)
Curve Fitting Toolbox                                 Version 3.5.4       (R2016b)
Image Processing Toolbox                              Version 9.5         (R2016b)
Instrument Control Toolbox                            Version 3.10        (R2016b)
MATLAB Compiler                                       Version 6.3         (R2016b)
MATLAB Compiler SDK                                   Version 6.3         (R2016b)
Signal Processing Toolbox                             Version 7.3         (R2016b)

--------------------------------------------------------------------------------------------------------------------------------------------------------

Many thanks in advance and best regards
-Hondo

Avatar
Adarsh_Murthy

Forum Posts: 59
sp_UserOfflineSmall Offline
4
May 16, 2017 - 5:17 pm
sp_Permalink sp_Print

Hi Hondo, 

I am not able to reproduce the error using the version of MATLAB and OS that you are using. I suspect it might have to do with the path being corrupted in your MATLAB session. To help us find the root cause of the error, could you run the following code snippet and tell us if you see any errors. Note that you need to provide a write API Key for your channel in the code below:

 

thingSpeakURL = 'https://api.thingspeak.com/';
thingSpeakWriteURL = [thingSpeakURL 'update'];
writeApiKey = 'your write API Key';
fieldName = 'field1';
fieldValue = 42;
response = webwrite(thingSpeakWriteURL,'api_key',writeApiKey,fieldName,fieldValue)

 

Thanks,

Adarsh

Avatar
Hondo
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
5
May 17, 2017 - 5:03 am
sp_Permalink sp_Print

Hi Adarsh,

unfortunately I got the following error message after running the code with my API Key:

Error using webwrite (line 123)
Undefined variable "matlab" or class "matlab.net.URI".

Best regards,
Hondo

Avatar
Adarsh_Murthy

Forum Posts: 59
sp_UserOfflineSmall Offline
6
May 17, 2017 - 3:29 pm
sp_Permalink sp_Print

Based on this error, it looks like MATLAB path has been corrupted. Could you run the following commands to restore MATLAB default path setup:

 

>> rehash toolbox

>> rehash toolboxcache

 

After running the above two commands try to run the code snippet that I shared with you to see if the issue is resolved.

 

Thanks,

Adarsh 

Avatar
Hondo
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
7
May 18, 2017 - 3:40 am
sp_Permalink sp_Print

Hi Adarsh,

after I have added the folder "C:\Program Files\MATLAB\R2016b\toolbox\matlab\external\interfaces\webservices" with all subfolders to the MATLAB default path,  the issue is resolved and I can write data to my channels Smile.

Many thanks for your support and best regards,
-Hondo

Avatar
Adarsh_Murthy

Forum Posts: 59
sp_UserOfflineSmall Offline
8
May 19, 2017 - 8:02 am
sp_Permalink sp_Print

Good to hear. Thanks for letting us know. 

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online: loli72
21 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 232

Vinod: 136

vespapierre: 63

piajola: 62

Adarsh_Murthy: 59

chrisjmears: 54

Newest Members:

loli72

beeconnections

py2alc

Tonibco6

Ge_O

Negron

Forum Stats:

Groups: 4

Forums: 17

Topics: 1148

Posts: 4060

 

Member Stats:

Guest Posters: 1

Members: 5340

Moderators: 0

Admins: 2

Administrators: Hans, lee