Reputation:
For example, if I want to get an integer from user, and use input function:
prompt = "please input the sigma value for Gaussian filtering"
sigma = input(prompt)
will give an error message
while
prompt = 'Please input the sigma value for Gaussian filtering'
sigma = input(prompt)
will successfully run and get the user input.
My question is, what is the difference between "" and ''?
Thank you.
Upvotes: 2
Views: 7389
Reputation: 143
While character arrays and strings are interchangeable in many ways, there are some differences.
Here is my favorite example for students:
>> a = ['1','2']
vs
>> b = ["1","2"]
The resulting a
is the character array '12'
while b
is a 1x2
string array with entries "1"
and "2"
.
A second, hopefully even more illuminating example, is
>> d = sprintf("%1.2e1",3.4)
>> e = sprintf('%1.2e1',3.4)
>> d(1)
>> e(1)
Notice how both styles can be used in string manipulation functions such as sprintf, but the resulting arrays are 1x1
for d
and 1xn
for e
Upvotes: 4