Hi, I'm trying to send a 'N' character with a number from a math operation, then 2 commands packed in one. I have a 2x10 float number vector and i want to send the first numbers row with 'd' character, then the 'i' character with the second number row, but i cant use at all the fprintf commad. this is the logic
data_numbers=[0.0150, 0.0140;
0.0236, 0.0264;
0.0329, 0.0371;]
characters=['i','d','N']
number=((t1+t2+t3)/(tiempo_muestreo))-1;
pause(0.8);
fprintf(bt, 'N%d',number)
for i=1 : height(data_numbers)
pause(0.8);
fprintf(bt, '%c%.4f', characters{1}(1,1),data_numbers(1,i));
pause(0.8);
fprintf(bt, '%c%.4f', characters{2}(1,1),data_numbers(2,i))
end
first, when i compile, matlab show me error like the following
Error using icinterface/fprintf (line 94)
The third input argument must be a character vector or string.
Error in untitled>ENVIAR_Callback (line 674)
fprintf(bt, 'N%d',number)
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in untitled (line 43)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)untitled('ENVIAR_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
I expect the output may:
N78
i0.0150
d0.0140
i0.0236
d0.0264
i0.0329
d0.0371
the number at the right side of 'N' character is already calculated but i have problems to send via fprintf to bluetooth, and the other data is without /n, I wrote that to make it more easy to read, actually it may be like:
N78i0.0150d0.0140i0.0236d0.0264i0.0329d0.0371