Undefined function 'real' for input arguments of type 'string' Error
4 次查看(过去 30 天)
显示 更早的评论
So i have been getting this error for quite a long and i don't know whats the problem in the code. Refer to the code, I have to plot the waveform of the data that is stored in the z variable after concatenation of several strings. The point is to get data from 8 different fields of same channel in Thingspeak platform. So far I have received data from the all fields and make a single string of the data. In the end, when I try to plot it prompt me with the following error and does not plot the data.
======> "Undefined function 'real' for input arguments of type 'string' Error" <======
Can somebody please guide me how to remove this error as I am not very familiar with MATLAB coding. Any help will be really appreciated.
data1=thingSpeakRead(readChannelID,'Fields',[1],'NumPoint',1,'OutputFormat','timetable');
data2=thingSpeakRead(readChannelID,'Fields',[2],'NumPoint',1,'OutputFormat','timetable');
data3=thingSpeakRead(readChannelID,'Fields',[3],'NumPoint',1,'OutputFormat','timetable');
data4=thingSpeakRead(readChannelID,'Fields',[4],'NumPoint',1,'OutputFormat','timetable');
data5=thingSpeakRead(readChannelID,'Fields',[5],'NumPoint',1,'OutputFormat','timetable');
data6=thingSpeakRead(readChannelID,'Fields',[6],'NumPoint',1,'OutputFormat','timetable');
data7=thingSpeakRead(readChannelID,'Fields',[7],'NumPoint',1,'OutputFormat','timetable');
data8=thingSpeakRead(readChannelID,'Fields',[8],'NumPoint',1,'OutputFormat','timetable');
L=string(data1.test1);
L1=extractBefore(L,"/");
x1=strsplit(L1,' ');
M=string(data2.test2);
M1=extractBefore(M,"/");
x2=strsplit(M1,' ');
N=string(data3.test3);
N1=extractBefore(N,"/");
x3=strsplit(N1,' ');
O=string(data4.test4);
O1=extractBefore(O,"/");
x4=strsplit(O1,' ');
P=string(data5.test5);
P1=extractBefore(P,"/");
x5=strsplit(P1,' ');
Q=string(data6.test6);
Q1=extractBefore(Q,"/");
x6=strsplit(Q1,' ');
R=string(data7.test7);
R1=extractBefore(R,"/");
x7=strsplit(R1,' ');
S=string(data8.test8);
x8=strsplit(S,' ');
z=cat(2,x1,x2,x3,x4,x5,x6,x7,x8)
thingSpeakPlot(z)
0 个评论
回答(0 个)
社区
更多回答在 ThingSpeak Community
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!