octave

Equality results when using a matrix of strings

被刻印的时光 ゝ 提交于 2021-02-10 12:56:54
问题 I don't understand why using == to compare between a string vector and a matrix of strings and the vector is of dimension n , I obtain a matrix of size n * n . I expected it to be of size n only, with a 1 when the string is equal. octave:13> t = ["aha";"bgb";"ctc"] t = aha bgb ctc octave:14> t == "aha" warning: mx_el_eq: automatic broadcasting operation applied ans = 1 1 1 0 0 0 0 0 0 What's going on underneath to explain such result ? And is it possible to do away with the warning: warning:

Equality results when using a matrix of strings

半城伤御伤魂 提交于 2021-02-10 12:56:03
问题 I don't understand why using == to compare between a string vector and a matrix of strings and the vector is of dimension n , I obtain a matrix of size n * n . I expected it to be of size n only, with a 1 when the string is equal. octave:13> t = ["aha";"bgb";"ctc"] t = aha bgb ctc octave:14> t == "aha" warning: mx_el_eq: automatic broadcasting operation applied ans = 1 1 1 0 0 0 0 0 0 What's going on underneath to explain such result ? And is it possible to do away with the warning: warning:

Equality results when using a matrix of strings

僤鯓⒐⒋嵵緔 提交于 2021-02-10 12:56:03
问题 I don't understand why using == to compare between a string vector and a matrix of strings and the vector is of dimension n , I obtain a matrix of size n * n . I expected it to be of size n only, with a 1 when the string is equal. octave:13> t = ["aha";"bgb";"ctc"] t = aha bgb ctc octave:14> t == "aha" warning: mx_el_eq: automatic broadcasting operation applied ans = 1 1 1 0 0 0 0 0 0 What's going on underneath to explain such result ? And is it possible to do away with the warning: warning:

How to run Octave code without the Octave IDE (similarly to Python)? [duplicate]

佐手、 提交于 2021-02-08 09:50:29
问题 This question already has answers here : Octave: How to prevent plot window from closing itself? (2 answers) Closed 2 days ago . Context: When I use Python + matplotlib, I can compose the code in any text editor (like Sublime Text), do CTRL + B , and then the text output appears in the "Build results" panel of the text editor, and, optionally, graph/plots are rendered in a new GUI window. Under the hood, the text editor calls python myscript.py when we do "Build", and that's it. It's simple

Subscript error: sum = sum(s)

大憨熊 提交于 2021-02-08 05:13:36
问题 Below is my code, where h and Y are 47x1 vectors. s = h-Y; sum = sum(s); I am getting this error: error: sum(6057.48): subscripts must be either integers 1 to (2^31)-1 or logicals Can somebody please explain why? 回答1: As mentioned in the comments by Sardar Usama , you cannot use the variable name sum when you also want to use the built-in function sum . By default, sum is a function, used as you expected it to work in your script. In Octave, you are permitted to overshadow a built-in function

Subscript error: sum = sum(s)

北城以北 提交于 2021-02-08 05:12:18
问题 Below is my code, where h and Y are 47x1 vectors. s = h-Y; sum = sum(s); I am getting this error: error: sum(6057.48): subscripts must be either integers 1 to (2^31)-1 or logicals Can somebody please explain why? 回答1: As mentioned in the comments by Sardar Usama , you cannot use the variable name sum when you also want to use the built-in function sum . By default, sum is a function, used as you expected it to work in your script. In Octave, you are permitted to overshadow a built-in function

Can I access sqlite3 using octave?

回眸只為那壹抹淺笑 提交于 2021-02-07 20:31:11
问题 Is there a way to read and write to sqlite3 from octave? I'm thinking something along the lines of RODBC in R or the sqlite3 package in python, but for octave. I looked on octave-forge http://octave.sourceforge.net/packages.php But could only find the 'database' package, which only supports postgresql. Details: OS: Ubuntu 12.04 Octave: 3.6.2 sqlite: 3.7.9 回答1: I realise this is an old question, but most answers here seem to miss the point, focusing on whether there exists a bespoke octave

Have a transparent background in a plot exported from Octave

心不动则不痛 提交于 2021-02-05 12:21:02
问题 I am using portable Octave 5.1.0 under Win 10. I mean to write a plot to png with transparent background. Disclaimer: This question is similar to the two linked below. I opted asking the present different question since I am adding further relevant information (by the same token, question #2 below was not a dupe of #1). This is what I found: print(gcf,'-dpngalpha', 'myplot.png'); , suggested in Saving a plot in Octave with transparent background, does not work for me. It is remarkable that I

Octave Rounding and Evaluation Order

会有一股神秘感。 提交于 2021-02-05 08:57:05
问题 In Octave I obtain 1 - 0.05 -0.95 = 0 and 1 - 0.95 -0.05 = 4.1633e-17 I understand that it is caused by the order of evaluation combined with the approximate binary representation of 0.05 as 0.00(0011) and 0.95 as 0.11(1100) Could someone please give me the whole story or show me a link explaining it? ---EDIT: This question is not a duplicate of Why is 24.0000 not equal to 24.0000 in MATLAB?, which was identified by others as a possible duplicate. The latter deals with the rounded

Oct files run under Octave 3.6.4 or 4.0.0 but not both

守給你的承諾、 提交于 2021-02-05 07:51:50
问题 I have two versions of Octave installed, version 3.6.4 installed via the package manager (Linux Mint Debian), and version 4.0.0 compiled from source. I also have numerous .oct files in a folder pointed to in an .octaverc file. My problem is that the version 4.0.0 cannot "see" these .oct files and if I try to call them the whole session crashes unless I recompile them under 4.0.0 with mkoctfile. However, doing this means that the version 3.6.4 cannot "see" them and trying to call them gives an