You have confused two different concepts.
In mathematics, it is common to write something like f(x) = x^2 + 1, and to have that be defining a mathematical transformation between input values and output values. Some authors prefer to write something like to make it clear that you are defining a mapping. This notation is formula notation.
In programming, it is common to write something like f(5) = x^2 + 1, with the intention that the current value of x is squared, one is added, and that the result is to be stored in the vector f indexed at location 5. [Depending on the programming language, that might be the 5th element of f, or might be the 6th element of x, or might perhaps be at some other offset of f.]
In programming, writing f(x) = x^2 + 1 would typically be understood as using indexing notation -- that the current numeric value of x is to be looked up, x^2 + 1 calculated, and the result to be stored in vector f indexed at the locations whose offset is in x. But your x (n in your case) values are not integers, and not many programming languages allow you to index arrays at non-integer locations. Some programming languages allow you to index at 0 (or sometimes even a negative integer), but MATLAB does not permit that. Some programming language use  notation for indexing -- as in f = x^2 + 1.
So, in MATLAB, when you wrote
you were asking to have MATLAB index a vector at locations 0, 1/fs, 2/fs, 3/fs and so on, and assign those locations the result of calculating 2*sin(2*pi*(n/fs)) with those definite fs values. But MATLAB does not permit indexing at 0 or non-integers.
In MATLAB, when you want to define a formula you should [usually] use anonymous functions, which would look like
x = @(n) 2*sin(2*pi*(n/fs));
This defines a formula -- and the @(n) says that inside the body of the formula, n should be replaced by whatever value is passed into the anonymous function at run time. Inside the @(n) definition, because n is inside the @(n) list, any value of n such as the n=0:1/fs:1 will be ignored.
But you should also consider just creating a vector:
This will take the current definite numeric values of n and calculate the sin and so on for them, and put the vector of values into x -- which will be an array not a formula.
There is one case where you can use f(x)=x^2+1 type of notation with MATLAB: if you are using symbolic variables.
This requires x to have been defined as symbolic before the assignment. The result is a symbolic function, as if you had done