I’m planning to do the following in matlab:
- Create an empty set
- Insert an element which specifies a certain criterion in it
So, as a quick run on the matlab command line I did the following:
>> e=78
e =
78
>> Ck=[]
Ck =
[]
>> Cn=Ck+e
Cn =
[]
But, I was expecting to get the following:
Cn = [78]
Why didn’t I get the expected result? And, how can I solve this out?
Thanks.
The
@plusoperator is defined as an arithmetic operation, but not as a set operation.To add to an existing (1D) set at specified locations, you perform catenation and/or indexing. For example, to add at the end of a set, you can write
or