Problem in sending data from arduino to matlab

Hi,

I want to run simple example in arduino and send data from arduino to matlab for drawing plot,

my arduino code is following:

#include <SoftwareSerial.h>

int i=0;
void setup() 
{
  Serial.begin(9600);
}
 
void loop() 
{
   Serial.println(i);
   i++; 
}

and my matlab code is following:

arduino=serial('COM4','BaudRate',9600);
fopen(arduino)
x=linspace(1,100);
for i=1:length(x)
    y(i)=instrfind(arduino);
	y(i)=fscanf(arduino,'%d');
end
fclose(arduino);
disp('making plot..')
plot(x,y);

But I've faced with error! The following is matlab error:

Error using serial/fopen (line 72)
Open failed: Port: COM4 is not available. No ports
are available.
Use INSTRFIND to determine if other instrument
objects are connected to the requested device.

Error in kh (line 2)
fopen(Arduino)

and here is arduino error:

avrdude: ser_open(): can't open device "\\.\COM4": Access is denied.

My arduino uno (COM4) driver in device manager are installed.
I use matlab 2013a and َArduino 1.8.1 Genuino

How can I fix this error?

How can I fix this error?

Close whatever app has COM4 tied up.