Matlab - hexadecimal number conversion | MATLAB | Forum


Please consider registering

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 - hexadecimal number conversion
No permission to create posts
January 4, 2018
9:22 am
New Member
Forum Posts: 1
Member Since:
January 4, 2018
sp_UserOfflineSmall Offline

Hi, i would like to ask for help.

I am sending value to thingspeek periodically (lets say every 5 minute) where the original message is number. But the transmission changes the string(number value) into hex format, so instead of 40 i do receive 3430, after 5 minutes instead of value lets say 45 i receive 3435 and so on. I want to plot original values. I started with analysis tool writing code below, but i need help with function for changing hexadeciaml value back into original value.

readChannelID = xxxxx;
readAPIKey = 'xxxxxx;
writeChannelID = xxxxxx;
writeAPIKey = 'xxxxxx;

data = thingSpeakRead(readChannelID, 'ReadKey', readAPIKey,'OutputFormat','table');
analyzedData = data;

analyzedData.('Counter') = data.('Counter');
thingSpeakWrite(writeChannelID, analyzedData, 'WriteKey', writeAPIKey);

Tank you
January 4, 2018
11:09 am

Forum Posts: 258
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

try this:

value = '3435';


notice that value has to be a character vector.

If you can keep the device or program that is posting from converting to hex, ThingSpeak will definitely accept field values as string.  However, adding a string manipulation class your code may not be easy if you are using a limited hardware.  

Forum Timezone: America/New_York

Most Users Ever Online: 114

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

JamesVex, meghanfr69, raqueldk69, soniafw2, vitalijDrine, JosephAmapy

Administrators: Hans: 387, lee: 457