octave

Octave/MATLAB: How to compare structs for equality?

杀马特。学长 韩版系。学妹 提交于 2020-01-09 10:36:36
问题 How do I compare two structs for equality in octave (or matlab)? Attempting to use the == operator yields: binary operator `==' not implemented for `scalar struct' by `scalar struct' operations 回答1: Use either the isequal or isequalwithequalnans function. Example code: s1.field1 = [1 2 3]; s1.field2 = {2,3,4,{5,6}}; s2 = s1; isequal(s1,s2) %Returns true (structures match) s1.field3 = [1 2 nan]; s2.field3 = [1 2 nan]; isequal(s1, s2) %Returns false (NaN ~= NaN) isequalwithequalnans(s1, s2)

How to generate random vector from specific user defined range?

馋奶兔 提交于 2020-01-07 05:56:11
问题 I want to generate the random vector containing the number from the user defined range. For example: numbers = [1 2 4 10] The random vector should always consist of these numbers. Eg. rand_num= [1 1 2 10 5 2 10] Thanks. 回答1: Let numbers = [1 2 4 10]; %// population to sample from N = 5; %// how many samples to take You can use randsample (Statistics Toolbox): rand_num = randsample(numbers, N, true); %// "true" means sample with replacement or randi (standard function): rand_num = numbers

statistics wiht large amount of data in C++ or Scilab or Octave or R

≡放荡痞女 提交于 2020-01-07 04:20:10
问题 I recently need to calculate the mean and standard deviation of a large number (about 800,000,000) of doubles. Considering that a double takes 8 bytes, if all the doubles are read into ram, it will take about 6 GB. I think I can use a divide and conquer approach with C++ or other high level languages, but that seems tedious. Is there a way that I can do this all at once with high level languages like R, Scilab or Octave? Thanks. 回答1: It sounds like you could use R-Grid or Hadoop to good

How to load 2D array from a text(csv) file into Octave?

只愿长相守 提交于 2020-01-06 19:54:19
问题 Consider the following text(csv) file: 1, Some text 2, More text 3, Text with comma, more text How to load the data into a 2D array in Octave? The number can go into the first column, and all text to the right of the first comma (including other commas) goes into the second text column. If necessary, I can replace the first comma with a different delimiter character. 回答1: AFAIK you cannot put stings of different size into an array. You need to create a so called cell array. A possible way to

Twitter图像编码挑战[关闭]

梦想的初衷 提交于 2020-01-06 16:11:36
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 如果一张图片价值1000字,你可以在140个字符中放入多少图片? 注意 :那就是大家! 赏金的最后期限就在这里,经过一番艰难的考虑后,我认为 Boojum的进入 只是勉强淘汰 Sam Hocevar的 。 一旦我有机会写下来,我会发布更详细的笔记。 当然,每个人都应该随时继续提交解决方案并改进人们投票的解决方案。 感谢所有提交和参赛的人; 我很喜欢他们。 这对我来说非常有趣,我希望这对参赛者和观众来说都很有趣。 我遇到了一篇关于尝试将图像压缩成Twitter评论的 有趣帖子 ,该线程中的很多人(以及 Reddit上的 一个 帖子 )都提出了有关不同方法的建议。 所以,我认为这将是一个很好的编码挑战; 让人们将钱放在嘴边,并展示他们对编码的看法如何在有限的空间中提供更多细节。 我挑战你想出一个通用系统,用于将图像编码成140个字符的Twitter消息,并将它们再次解码为图像。 您可以使用Unicode字符,因此每个字符的字符数超过8位。 但是,即使允许使用Unicode字符,也需要将图像压缩到非常小的空间内; 这肯定会是一种有损压缩,因此必须对每种结果的好看进行主观判断。 以下是原作者 Quasimondo 从他的编码中获得的结果(图片根据 知识共享署名 - 非商业许可证授权 ): 你能做得更好吗? 规则

Run Octave from Emacs on iMac

我与影子孤独终老i 提交于 2020-01-06 14:22:57
问题 Octave is installed on my iMac in /applications and works properly. Emacs is installed on my iMac in /applications and file editing is possible. Now I want to run Octave from Emacs. M-x run-octave results in: Searching for program: No such file or directory, octave In Windows I solved this problem by adding Octave to the environment path, how can I do this on a Mac? Thank in advance, Hans Sellmeijer 回答1: Here are two possible solutions: Find the actual Octave executable by typing which octave

Run Octave from Emacs on iMac

元气小坏坏 提交于 2020-01-06 14:21:56
问题 Octave is installed on my iMac in /applications and works properly. Emacs is installed on my iMac in /applications and file editing is possible. Now I want to run Octave from Emacs. M-x run-octave results in: Searching for program: No such file or directory, octave In Windows I solved this problem by adding Octave to the environment path, how can I do this on a Mac? Thank in advance, Hans Sellmeijer 回答1: Here are two possible solutions: Find the actual Octave executable by typing which octave

Scilab, backdoor error, octave conflict

╄→尐↘猪︶ㄣ 提交于 2020-01-05 08:18:13
问题 I installed scilab.6.0.0 and backdoor fromscilab website (which I could not find it from Application>Module maneger>atom>Technical). I moved the backdoor file my home and from scilab command line I installed it -->atomsInstall('/home/user/BackDoor_0.2_5.5.bin.x86_64.linux.tar.gz') Even though, it installed backdoor successfully, when I restart the scilab I got this error message with backdoor Start Toolbox BackDoor Load macros atomsLoad: An error occurred while loading 'BackDoor-0.2': lib:

How to set tics in x or y axis using range in GNU Octave?

一个人想着一个人 提交于 2020-01-05 07:08:14
问题 length of x = 1000, length of y = 1000 plot(x, y, '+'); xlabel ("p"); ylabel ("Q(p)"); title('Custom plot'); set(gca, 'xtick', [0.00000 0.20000 0.40000 0.60000 0.80000 1.00000]) This set command creates 6 tics in X axis, but I like to create 20 ticks so that there are 50 elements in between 2 tics. Thanks in advance. 回答1: From your comment I guess you don't know the concept behind Octaves "range". see here In your case if you want the xticks go from 0 to 1000 and the difference between the

Octave: Box and whisker plot without spread from GeoTIFF

孤人 提交于 2020-01-05 05:53:30
问题 ---- Update with what I got so far and what's left to resolve can be found in point 3 below ---- Using Octave I want to create 30 horizontal box and whisker plots without spread (x-axis) from 30 different GeoTIFF's. This is a sketch of how I would like the plot to look like: Ideally the best solution for me would be an Octave code (workflow) that would allow me to place multiple GeoTIFFs in one directory and then with one click create a box and whisker plot for all GeotIFFs at once - just