Email: helpdesk@telkomuniversity.ac.id

This Portal for internal use only!

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Categories
  • Microsoft
    • Microsoft Apps
    • Office
    • Operating System
    • VLS
    • Developer Tools
    • Productivity Tools
    • Database
    • AI + Machine Learning
    • Middleware System
    • Learning Services
    • Analytics
    • Networking
    • Compute
    • Security
    • Internet Of Things
  • Adobe
  • Matlab
  • Google
  • Visual Paradigm
  • WordPress
    • Plugin WP
    • Themes WP
  • Opensource
  • Others
More Categories Less Categories
  • Get Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • My Account
    • Download
    • Cart
    • Checkout
    • Login
  • About Us
    • Contact
    • Forum
    • Frequently Questions
    • Privacy Policy
  • Forum
    • News
      • Category
      • News Tag

iconTicket Service Desk

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Menu
  • Home
    • Download Application Package Repository Telkom University
    • Application Package Repository Telkom University
    • Download Official License Telkom University
    • Download Installer Application Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • All Pack
    • Microsoft
      • Operating System
      • Productivity Tools
      • Developer Tools
      • Database
      • AI + Machine Learning
      • Middleware System
      • Networking
      • Compute
      • Security
      • Analytics
      • Internet Of Things
      • Learning Services
    • Microsoft Apps
      • VLS
    • Adobe
    • Matlab
    • WordPress
      • Themes WP
      • Plugin WP
    • Google
    • Opensource
    • Others
  • My account
    • Download
    • Get Pack
    • Cart
    • Checkout
  • News
    • Category
    • News Tag
  • Forum
  • About Us
    • Privacy Policy
    • Frequently Questions
    • Contact
Home/Matlab/Why does my daily median calculation and write to channel fail unpredictably?

Why does my daily median calculation and write to channel fail unpredictably?

PuTI / 2025-05-08
Why does my daily median calculation and write to channel fail unpredictably?
Matlab News

I am trying to calculate the daily median across a range of channels and write the result to a new field for each channel. The code seems to run sometimes, but runs into rate limitation other times. I’m not sure why since I am only writing once and to different channels?
Error using Median calcs (line 39)
Requests are too frequent. For further information, see Limitations in the documentation.
My code is:
% Sensor/channel configuration
sensors = [
struct(‘name’, ‘McKinley’,’channelID’, 28xxxx, ‘writeKey’, ‘G3WPJ586M55Gxxxx’)
struct(‘name’, ‘DPI’, ‘channelID’, 80xxxx, ‘writeKey’, ‘S0E0LB45GQLMxxxx’)
struct(‘name’, ‘Bryony’,’channelID’, 29xxxx, ‘writeKey’, ‘2BPCI0IOAINPxxxx’)
];

% Define date range (last 24 hours to midnight)
endTime = dateshift(datetime(‘now’), ‘start’, ‘day’);
startTime = endTime – hours(24);

% Preallocate a results array
results = [];

% Step 1: Read and calculate all medians
for i = 1:length(sensors)
s = sensors(i);

% Read Field 1 for the past 24 hours
[weight, ~] = thingSpeakRead(s.channelID, ‘DateRange’, [startTime, endTime], ‘Fields’, 1);

% Compute median, ignoring NaNs
medianWeight = round(median(weight, ‘omitnan’),2);

% Store in results
results(i).name = s.name;
results(i).channelID = s.channelID;
results(i).writeKey = s.writeKey;
results(i).value = medianWeight;
end

% Step 2: Display results
for i = 1:length(results)
r = results(i);
fprintf(‘%s (Channel %d) → 24hr Median: %.2fn’, r.name, r.channelID, r.value);
end

% Step 3: Write results
thingSpeakWrite(results(1).channelID, ‘Fields’, 6, ‘Values’, {results(1).value}, ‘WriteKey’, results(1).writeKey);
thingSpeakWrite(results(2).channelID, ‘Fields’, 6, ‘Values’, {results(2).value}, ‘WriteKey’, results(2).writeKey);
thingSpeakWrite(results(3).channelID, ‘Fields’, 6, ‘Values’, {results(3).value}, ‘WriteKey’, results(3).writeKey);I am trying to calculate the daily median across a range of channels and write the result to a new field for each channel. The code seems to run sometimes, but runs into rate limitation other times. I’m not sure why since I am only writing once and to different channels?
Error using Median calcs (line 39)
Requests are too frequent. For further information, see Limitations in the documentation.
My code is:
% Sensor/channel configuration
sensors = [
struct(‘name’, ‘McKinley’,’channelID’, 28xxxx, ‘writeKey’, ‘G3WPJ586M55Gxxxx’)
struct(‘name’, ‘DPI’, ‘channelID’, 80xxxx, ‘writeKey’, ‘S0E0LB45GQLMxxxx’)
struct(‘name’, ‘Bryony’,’channelID’, 29xxxx, ‘writeKey’, ‘2BPCI0IOAINPxxxx’)
];

% Define date range (last 24 hours to midnight)
endTime = dateshift(datetime(‘now’), ‘start’, ‘day’);
startTime = endTime – hours(24);

% Preallocate a results array
results = [];

% Step 1: Read and calculate all medians
for i = 1:length(sensors)
s = sensors(i);

% Read Field 1 for the past 24 hours
[weight, ~] = thingSpeakRead(s.channelID, ‘DateRange’, [startTime, endTime], ‘Fields’, 1);

% Compute median, ignoring NaNs
medianWeight = round(median(weight, ‘omitnan’),2);

% Store in results
results(i).name = s.name;
results(i).channelID = s.channelID;
results(i).writeKey = s.writeKey;
results(i).value = medianWeight;
end

% Step 2: Display results
for i = 1:length(results)
r = results(i);
fprintf(‘%s (Channel %d) → 24hr Median: %.2fn’, r.name, r.channelID, r.value);
end

% Step 3: Write results
thingSpeakWrite(results(1).channelID, ‘Fields’, 6, ‘Values’, {results(1).value}, ‘WriteKey’, results(1).writeKey);
thingSpeakWrite(results(2).channelID, ‘Fields’, 6, ‘Values’, {results(2).value}, ‘WriteKey’, results(2).writeKey);
thingSpeakWrite(results(3).channelID, ‘Fields’, 6, ‘Values’, {results(3).value}, ‘WriteKey’, results(3).writeKey); I am trying to calculate the daily median across a range of channels and write the result to a new field for each channel. The code seems to run sometimes, but runs into rate limitation other times. I’m not sure why since I am only writing once and to different channels?
Error using Median calcs (line 39)
Requests are too frequent. For further information, see Limitations in the documentation.
My code is:
% Sensor/channel configuration
sensors = [
struct(‘name’, ‘McKinley’,’channelID’, 28xxxx, ‘writeKey’, ‘G3WPJ586M55Gxxxx’)
struct(‘name’, ‘DPI’, ‘channelID’, 80xxxx, ‘writeKey’, ‘S0E0LB45GQLMxxxx’)
struct(‘name’, ‘Bryony’,’channelID’, 29xxxx, ‘writeKey’, ‘2BPCI0IOAINPxxxx’)
];

% Define date range (last 24 hours to midnight)
endTime = dateshift(datetime(‘now’), ‘start’, ‘day’);
startTime = endTime – hours(24);

% Preallocate a results array
results = [];

% Step 1: Read and calculate all medians
for i = 1:length(sensors)
s = sensors(i);

% Read Field 1 for the past 24 hours
[weight, ~] = thingSpeakRead(s.channelID, ‘DateRange’, [startTime, endTime], ‘Fields’, 1);

% Compute median, ignoring NaNs
medianWeight = round(median(weight, ‘omitnan’),2);

% Store in results
results(i).name = s.name;
results(i).channelID = s.channelID;
results(i).writeKey = s.writeKey;
results(i).value = medianWeight;
end

% Step 2: Display results
for i = 1:length(results)
r = results(i);
fprintf(‘%s (Channel %d) → 24hr Median: %.2fn’, r.name, r.channelID, r.value);
end

% Step 3: Write results
thingSpeakWrite(results(1).channelID, ‘Fields’, 6, ‘Values’, {results(1).value}, ‘WriteKey’, results(1).writeKey);
thingSpeakWrite(results(2).channelID, ‘Fields’, 6, ‘Values’, {results(2).value}, ‘WriteKey’, results(2).writeKey);
thingSpeakWrite(results(3).channelID, ‘Fields’, 6, ‘Values’, {results(3).value}, ‘WriteKey’, results(3).writeKey); write limitation, thingspeak MATLAB Answers — New Questions

​

Tags: matlab

Share this!

Related posts

Optimal decimation to Log Simulation Data
2025-05-18

Optimal decimation to Log Simulation Data

I need to use a scope to display the current i and the power P as functions of the voltage V, with the curves obtained for various irradiance levels and temperatures
2025-05-18

I need to use a scope to display the current i and the power P as functions of the voltage V, with the curves obtained for various irradiance levels and temperatures

Break in and break away points on Root Locus
2025-05-18

Break in and break away points on Root Locus

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Categories

  • Matlab
  • Microsoft
  • News
  • Other
Application Package Repository Telkom University

Tags

matlab microsoft opensources
Application Package Download License

Application Package Download License

Adobe
Google for Education
IBM
Matlab
Microsoft
Wordpress
Visual Paradigm
Opensource

Sign Up For Newsletters

Be the First to Know. Sign up for newsletter today

Application Package Repository Telkom University

Portal Application Package Repository Telkom University, for internal use only, empower civitas academica in study and research.

Information

  • Telkom University
  • About Us
  • Contact
  • Forum Discussion
  • FAQ
  • Helpdesk Ticket

Contact Us

  • Ask: Any question please read FAQ
  • Mail: helpdesk@telkomuniversity.ac.id
  • Call: +62 823-1994-9941
  • WA: +62 823-1994-9943
  • Site: Gedung Panambulai. Jl. Telekomunikasi

Copyright © Telkom University. All Rights Reserved. ch

  • FAQ
  • Privacy Policy
  • Term

This Application Package for internal Telkom University only (students and employee). Chiers... Dismiss