MATLAB: Error using sscanf Invalid format.

error

this is my code and i am gettin the above mentioned error help would be apreciated
% Button pushed function: SelectFileButton
function SelectFileButtonPushed(app, event)
[F,P] = uigetfile();
Results1 = fullfile(P,F);
Results2 = fopen(Results1);
Results4 = [0,0,0];
FlowRatePulse = [];
Pressure = [];
n = 0;
Time = 0;
while n >= 0
n = n+1;
Results3 = fgetl(Results2);
Results5 = sscanf(Results3,Results4);
Pressure(n) =((-0.2+Results5(1,1))/0.0018)/5;
FlowRatePulse(n) = Results5(1,2)/330;
Time = Time + Results5(1,3);
end
plot(app.UIAxes,Pressure,FlowRatePulse,'o')
plot(app.UIAxes2,Time,Pressure,'o')
plot(app.UIAxes3,Time,FlowRatePulse,'o')
end

Best Answer

The sscanf documentation explains its syntax as "A = sscanf(str,formatSpec) reads data from str, converts it according to the format specified by formatSpec..." and also specifies that " formatSpec can be a character vector in single quotes, or a string scalar."
Rather than following what the documentation requires, you have defined the format specifier as the numeric vector [0,0,0]. Instead of a numeric vector, you should be providing a character vector or a string scalar, as the documentation states. The documentation also has plenty of examples of the format specifier.