Quotes matlab please help

hi. this is so simple issue yet i am not sure what to do. while displaying or just ploting something,or defining something in matlab we say " syms 'x' " right? but i dont have that quotes in my keyboaard i guess, or i am totally missing something. that symbol is ' but i have ' . It doesnt look different in here so i am adding a photo. They were in same font i cant do that 90 degree quotes in my keyboard helpp

2 Comments

Because no(?) common keyboard layout contains the complete set of typographers quotation marks, so-called "smart-quotes" is a feature of word-processing applications (not MATLAB), e.g.:
Note that curly single/double quotation marks are not part of ASCII and as such are not part of MATLAB code.
This wouldn't have anything to do with using the new fancy scripting environment rather than the command window by any chance, would it? I've never opened it so know nothing about it, so just totally off the wall...

Sign in to comment.

Answers (1)

What layout is your keyboard setup? On my 104 key US-QWERTY the single quote character used to create a char vector is immediately to the left of the Enter key while the other single quote character is immediately above my Tab key.
For the specific command you indicated, as a workaround you don't actually have to type the ' character. You could use command form:
syms x
which is equivalent to the function form (I'm changing the variable name so you can see they both work):
syms('y')
Or you could use double quotes to make a string array if you're using a release of MATLAB from the past couple years.
syms("z")
whos x y z
Name Size Bytes Class Attributes x 1x1 8 sym y 1x1 8 sym z 1x1 8 sym

6 Comments

Ewww...that'd be a pain, indeed!
Besides the use for a lteral char() stirng, there's the transpose operator that would really tough to have to kludge around.
no it was just an example but while displaying something -i am a beginer but- as i know we can not use ", we have to use straight '. My keyboard is Q type. ı have an exam tomorror so i guess i will use ctrl+v eaxh time hahsha thank you for your answers
I was just commiserating that if your keyboard mapping doesn't have the single quote that using MATLAB will be painful.
The other single quote on the US QWERTY keyboard Steven mentions is the back-quote, it isn't the same character so can't be used instead.
Any chance you can use a different keyboard mapping? Which OS are you using?
yes i am using US QWERTY keyboard too. by single quote is at 2 but it is not straight so i cant use it. thank you for spare time on my issue.
Word (and many other rich text editors) will convert single quotes to the rounded quotes you showed in your screenshot. Matlab should not do that. Unless there is something strange with your keyboard layout (e.g. some RGB keyboard software?) or something very strange with your Matlab configuration this should not be happening.
dpb: If you had to you could call transpose or ctranspose to work around the single quote not working. It is more typing, but it is possible.
Rik: I've gotten so annoyed with Microsoft Word's automatic replacement with "smart quotes" when I'm typing code into a Word document or an email in Microsoft Office that I disabled that option.
Bilge Bengi Boyraz: if you're using a sufficiently recent release of MATLAB (I want to say release R2016b or later, but I'm not certain) then you can define a string array using the double quote character and most if not all of the functions that can operate on char arrays can also operate on string arrays.
D = ["Doc", "Dopey", "Happy", "Sneezy", "Sleepy", "Grumpy", "Bashful"];
D2 = sort(D)
Also if your keyboard has the single quote character "at 2" then you're not using a US QWERTY keyboard. Can you attach a picture of your keyboard to either your original question or to a comment?
Are you typing this code into MATLAB (the MATLAB Command Window or MATLAB Editor) or into a Word document or Outlook email?
Finally, if you're using Microsoft Windows one of the accessibility tools that it provides is an on-screen keyboard. Open the Start menu and start typing "on-screen keyboard". Try opening that and see if it's possible to type the correct single quote character into MATLAB using that keyboard. This will serve as both a diagnostic step and a potential workaround.

Sign in to comment.

Categories

Products

Asked:

BBB
on 17 Jan 2021

Commented:

dpb
on 18 Jan 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!