How do I plot data in Octave?


I wanted to plot a data in Octave for a logistic regression problem my teacher in my university assigned me to solve. Let's say the input-training features is a matrix X and output is y=1 or y=0 To plot the data I made this statement:

pos = find(y==1);neg = find(y==0);



But it does not compile and it shows the single quotes as unidentified characters. Please help...


Posted 2020-06-02T07:23:37.977

Reputation: 17



I am not an Octave expert, but it seems that you answered your own question. The quotation marks that you posted in your question are indeed not "regular" quotation marks.

Fix these characters and your code should run smoothly.

Also, maybe I am being pedantic, but since Octave is an interpreted language, it doesn't technically "compile" anything.

Valentin Calomme

Posted 2020-06-02T07:23:37.977

Reputation: 4 666

Thank you for your opinion.But I did not understand what you meant by "fix".Did you mean use double quotes instead? – MrPythonic – 2020-06-02T08:56:51.260

Yes, replace it. Right now, the character you used as a quotation mark IS NOT a quotation mark. It just looks like it. – Valentin Calomme – 2020-06-02T09:33:01.777

Hmm it still does not work.By the way I use ms word to code the program as a function PlotData(X,y) and later call it in Octave command prompt,I hope this gives you a hint to help me. – MrPythonic – 2020-06-02T11:53:40.630

If you want to help, then you should post the actual error message that you receive. And you should make your code in a way that I can run it as well. At this point, I have no way to run your code as y is an unknown variable. – Valentin Calomme – 2020-06-02T13:41:28.030

@MrPythonic if you don't have a regular quotation mark on your keyboard, you can just copy-paste it. You can choose between ' and " :) – Avi – 2020-11-16T20:09:47.870