Thingspeakwrite error when using string array

조회 수: 2 (최근 30일)
Dion Guek
Dion Guek 2017년 11월 13일
편집: Christopher Stapels 2017년 12월 20일
This string of code is taken from the thingSpeak documentation for matlab. I just copy and paste but still got this error. I would very much appreciate it if anyone can tell me where i did wrong
  댓글 수: 2
Geoff Hayes
Geoff Hayes 2017년 11월 13일
Dion - which version of MATLAB are you using? If you type doc thingSpeakWrite what does the documentation say about the data (second) input (are strings allowed)?
Dion Guek
Dion Guek 2017년 11월 13일
편집: Jan 2017년 11월 13일
My matlab version is 2017b student edition. Based on the attached picture above, the data can be a string. This is taken from the doumentation page from https://www.mathworks.com/help/thingspeak/thingspeakwrite.html

댓글을 달려면 로그인하십시오.

채택된 답변

Christopher Stapels
Christopher Stapels 2017년 12월 20일
편집: Christopher Stapels 2017년 12월 20일
When you write string data to ThingSpeak, it generally wants to have a cell array. You should not usually need to do the String() conversion yourself. Try
thingSpeakWrite(349672,{ans},'Location',[-40,23],'WriteKey',writeKey);
and
thingSpeakWrite(channelID,{2.3,'on','good'},'Location',[-40,23],'WriteKey',writeKey);
Ill have a look at fixing that documented example, thanks for pointing it out.

추가 답변 (0개)

커뮤니티

더 많은 답변 보기:  ThingSpeak 커뮤니티

카테고리

Help CenterFile Exchange에서 ThingSpeak에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by