title: Too many input arguments
body: <p>I get the following error message about too many input arguments in my fprintf function. But it seems to me that just the right amount of arguments were passed.</p>
  
  <p>All this is in the context of a guide GUI I made (see picture at the end).</p>
  
  <pre><code>Error while evaluating uicontrol Callback
  
  calibration button hit
      20
  
     200
  
  10
  10
          2520
  
         25197
  
  2520
  25197
      'C0 2520 25197 10 10'
  
  Error using serial/fprintf (line 115)
  Too many input arguments.
  
  Error in UserInterface&gt;StaticCalibrationBtn_Callback (line 202)
  fprintf(handles.s, 'C0 %s %s %s %s',StartStepsStr,EndStepsStr,Increment,Wait); 
  </code></pre>
  
  <p>Here is the code</p>
  
  <pre><code>function StaticCalibrationBtn_Callback(hObject, eventdata, handles)
      % hObject    handle to StaticCalibrationBtn (see GCBO)
      % eventdata  reserved - to be defined in a future version of MATLAB
      % handles    structure with handles and user data (see GUIDATA)
      disp('calibration button hit');
      Start = str2double(get(handles.CalFromUserTxt, 'string')); % Fetches the user inputed start location in mm and converts to double
      disp(Start);
      End = str2double(get(handles.CalToUserTxt, 'string')); % same for End position
      disp(End);
      Increment = get(handles.CalUserIncrementTxt, 'string'); % fetches the increment user inputed data as a string
      disp(Increment);
      Wait = get(handles.CalUserSpeedTxt, 'string'); % fetches the wait inputed data as a string
      disp(Wait);
      StartSteps = round(Start/0.00793750000); % computes the starting step position,double division
      disp(StartSteps);
      handles.StartSteps = StartSteps; % creats a place for the start steps inside the handles structure, to be fetched by anythingelsest be saved with guidata(hObject,handles)
      EndSteps = round(End/0.00793750000); % computes the end step position
      disp(EndSteps);
      handles.EndSteps = EndSteps; % stores the end steps to be accessed by anything else must be saved with guidata(hObject,handles)
      StartStepsStr = num2str(StartSteps); % converts the StartSteps double into a string so it can be sent over serial as a string
      disp(StartStepsStr);
      EndStepsStr = num2str(EndSteps); % converts the EndSteps double into a string so it can be sent over serial as a string
      disp(EndStepsStr);
      OutputString = strcat('C0' , {' '} , StartStepsStr , {' '} , EndStepsStr , {' '} , Increment , {' '} , Wait);
      disp(OutputString);
      fprintf(handles.s, 'C0 %s %s %s %s',StartStepsStr,EndStepsStr,Increment,Wait);
  </code></pre>
  
  <p>and where handles.s comes from</p>
  
  <pre><code>function SerialBtn_Callback(hObject, eventdata, handles)
  % hObject    handle to SerialBtn (see GCBO)
  % eventdata  reserved - to be defined in a future version of MATLAB
  % handles    structure with handles and user data (see GUIDATA
  comPort = get(handles.COMportTxt,'String');
  if(~exist('serialFlag','var'))
      [handles.s, handles.serialFlag] = setupSerial(comPort);
  end
  guidata(hObject,handles);
  end
  </code></pre>
  
  <p>And the setupserial funciton</p>
  
  <pre><code>function [ s, flag] = setupSerial(comPort)
  %Initialize serial port communication between Arduino and Matlab
  %Ensure that the arduino is also communicating with Matlab at this time. 
  %if setup is complete then the value of setup is returned as 1 else 0.
  
  flag =1;
  s = serial(comPort);
  set(s,'DataBits',8);
  set(s,'StopBits',1);
  set(s,'BaudRate',9600);
  set(s,'Parity','none');
  fopen(s);
  a='b';
  while (a~='a')
      a=fread(s,1,'uchar');
  end
  if (a=='a')
      disp('serial read');
  end
  fprintf(s,'%c','a');
  mbox = msgbox('Serial Communication setup.'); uiwait(mbox);
  fscanf(s,'%u');
  end
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/CZDyc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CZDyc.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>USING THE FOLLOWING RESOLVED THE ISSUE</p>
  
  <pre><code>OutputString = sprintf('C0 %s %s %s %s',StartStepsStr,EndStepsStr,Increment,Wait);
  fprintf(handles.s,'%s', OutputString);
  </code></pre>