![]() |
Internet of Things – How to Get Started
<header>
<h1> <a href="https://blogs.mathworks.com/loren/2019/07/09/internet-of-things-how-to-get-started/">Internet of Things – How to Get Started</a> <span><a href="https://blogs.mathworks.com/loren/2019/07/09/internet-of-things-how-to-get-started/#view_comments">1</a></span></h1> <p>Posted by <b><a href="https://www.mathworks.com/matlabcentral/profile/authors/136425-loren-shure?s_tid=blg_to_profile">Loren Shure</a></b>, <time>July 9, 2019</time> </p> </header> <div> <div> <div><p>I'm sure you've heard of IoT, Internet of Things. And people talk about connected devices, and getting the data from them to use in applications. I want to show you a very simple example to spark some ideas in each of you.</p><h3>Contents</h3><div><ul><li><a href="https://blogs.mathworks.com/loren/2019/07/09/internet-of-things-how-to-get-started/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+mathworks%2Floren+%28Loren+on+the+Art+of+MATLAB%29#219bfb31-d9f9-4406-b39b-1e4fd0794db3">Example</a></li><li><a href="https://blogs.mathworks.com/loren/2019/07/09/internet-of-things-how-to-get-started/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+mathworks%2Floren+%28Loren+on+the+Art+of+MATLAB%29#c8fcc086-b71b-4679-9f07-466406c05bbb">IoT</a></li></ul></div><h4>Example<a></a></h4><p>IoT allows you access or serve data that is not local to users who want to use it. We have the <a href="https://www.mathworks.com/products/thingspeak.html">ThingSpeak</a> portion of our website that you can use to access and analyze live streamed data in the cloud. And we recently added the ability to access these same channels of information directly from a MATLAB session when you have internet access. Here's an example of <a href="https://thingspeak.com/channels/12397">some simple weather day</a> you can access, including windspeed (mph), humidity, and temperature (F). The first thing I'll do is grab these 3 channels of information for 3 days.</p><pre>data = thingSpeakRead(12397,<span>'Fields'</span>,2:4,<span>'NumDays'</span>,3,<span>'OutputFormat'</span>, <span>...</span> <span>'TimeTable'</span>); </pre><p>Let's preview the data with <tt><a href="https://www.mathworks.com/help/matlab/ref/topkrows.html">topkrows</a></tt>.</p><pre>topkrows(data,8) </pre><pre>ans = 8×3 timetable Timestamps WindSpeedmph Humidity TemperatureF ____________________ ____________ ________ ____________ 09-Jul-2019 09:29:03 3.3 36 82.4 09-Jul-2019 09:28:02 4.2 37 82.3 09-Jul-2019 09:27:01 5 37 82.3 09-Jul-2019 09:25:59 2.8 37 82.2 09-Jul-2019 09:24:58 2.9 37 82.1 09-Jul-2019 09:23:58 4.3 37 82.1 09-Jul-2019 09:22:55 2.8 37 82.1 09-Jul-2019 09:21:54 2.8 37 81.9 </pre><p>I asked for the data to be returned in a <tt><a href="https://www.mathworks.com/help/matlab/ref/timetable.html">timetable</a></tt>. How many points did I collect?</p><pre>numDataPoints = height(data) </pre><pre>numDataPoints = 4228 </pre><p>Let's look at the data now. It's interesting to compare the trends of the data we chose to view. I'm using a <tt><a href="https://www.mathworks.com/help/matlab/ref/stackedplot.html">stackedplot</a></tt></p><pre>h = stackedplot(data); </pre><img src="https://blogs.mathworks.com/images/loren/2019/iotDemo_01.png"/> <h4>IoT<a></a></h4><p>If you are interested in learning more about IoT with MATLAB, I highly recommend reading <a href="https://blogs.mathworks.com/iot/">Hans's blog</a>.</p><p>Let me know how you might take advantage of ThingSpeak <a href="https://blogs.mathworks.com/loren/?p=3388#respond">here</a>.</p><p><br/><a><span>Get the MATLAB code </span></a><br/><br/> </p></div> </div> </div> [url=http://feedproxy.google.com/~r/mathworks/loren/~3/JoZlfQT65fA/]More...[/url] |
所有时间均为北京时间。现在的时间是 23:20。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.