octave

Octave Fontconfig error

让人想犯罪 __ 提交于 2019-12-03 07:47:56
问题 I installed Octave via Homebrew using the instructions given here. When I try to generate a plot, I get the following message: Fontconfig error: Cannot load default config file warning: could not match any font: *-normal-normal-10 warning: called from axes at line 66 column 10 gca at line 58 column 9 newplot at line 148 column 8 surf at line 70 column 9 sombrero at line 65 column 5 I then get a long series of the following messages: warning: ft_render: unable to load appropriate font warning:

Octave installing package fails on mac osx (Segmentation fault)

余生长醉 提交于 2019-12-03 07:29:56
I am trying to install general package (general-1.3.4.tar.gz) to octave 3.8.0. Im using mac osx Yosemite. Im getting segmentation fault. This occurs no matter which package I try to install (for example singal). I have xcode and command line tools installed. All help will be appreciated. Here is the error i get when executing pkg install general-1.3.4.tar.gz: octave:3> pkg install general-1.3.4.tar.gz /usr/local/octave/3.8.0/bin/mkoctfile-3.8.0: line 512: 15159 Segmentation fault: 11 /usr/local/octave/3.8.0/bin/g++-mp-4.7 -c -fPIC -I/usr/local/octave/3.8.0/include/octave-3.8.0/octave/.. -I/usr

Remove a column from a matrix in GNU Octave

微笑、不失礼 提交于 2019-12-03 06:28:31
问题 In GNU Octave, I want to be able to remove specific columns from a matrix. In the interest of generality. I also want to be able to remove specific rows from a matrix. Suppose I have this: mymatrix = eye(5) mymatrix = Diagonal Matrix 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 I want to remove columns 2 and 4, but when I remove column 2, the position of column 4 has moved to column 3, and that makes my head hurt. There has to be a better way! 回答1: GNU Octave delete Columns 2 and 4 from

MATLAB repeat numbers based on a vector of lengths

不想你离开。 提交于 2019-12-03 06:03:26
Is there a vectorised way to do the following? (shown by an example): input_lengths = [ 1 1 1 4 3 2 1 ] result = [ 1 2 3 4 4 4 4 5 5 5 6 6 7 ] I have spaced out the input_lengths so it is easy to understand how the result is obtained The resultant vector is of length: sum(lengths) . I currently calculate result using the following loop: result = ones(1, sum(input_lengths )); counter = 1; for i = 1:length(input_lengths) start_index = counter; end_index = counter + input_lengths (i) - 1; result(start_index:end_index) = i; counter = end_index + 1; end EDIT: I can also do this using arrayfun

How to load packages in Octave permanently?

匆匆过客 提交于 2019-12-03 05:15:46
I am using Octave on Window vista. I am using 4 package in my code. But every time I restart octave, I have to load manually from command line, 'pkg load ...' Is there a way to load them permanently so that whenever Octave is started it finds them in its path. When Octave starts, it runs ~/.octaverc . If you want Octave to automatically load a package, simply add a pkg load pkg-name command to it. If the files does not exist, create it. If you do this, remember that other people may not have Octave configured to load packages at startup. Therefore, if you write code for others, remember that

Switching values to plot using keyboard input

限于喜欢 提交于 2019-12-03 04:41:26
I have sets of data in a matrix. I want to plot on set and then use a keyboard input to move to another one. It's simply possible this way: for t=1:N plot(data(:,t)) pause end but I want to move forward and backward in time t (e.g. using arrows). OK, it could be done like this: direction = input('Forward or backward?','s') if direction=='forward' plot(data(:,ii+1)) else plot(data(:,ii-1)) end but isn't there something more elegant? (On one click without getting the figure of the sight - it's a big full sreen figure.) You can use mouse clicks combined with ginput . What you can do is put your

Euclidean distance between two vectors (single row matrix)

ⅰ亾dé卋堺 提交于 2019-12-03 02:29:45
I have two vectors (single row matrices). Assume that we already know the length len . A = [ x1 x2 x3 x4 x5 .... ] B = [ y1 y2 y3 y4 y5 .... ] To calculate Euclidean distance between them what is the fastest method. My first attempt is: diff = A - B sum = 0 for column = 1:len sum += diff(1, column)^2 distance = sqrt(sum) I have loop through this methods millions of times. So, I am looking for something which is fast and correct. Note that I am not using MATLAB and don't have pdist2 API available. diff = A - B; distance = sqrt(diff * diff'); or distance = norm(A - B); [val idx] = sort(sum(abs

How should I do rapid GUI development for R and Octave methods (possibly with Python)?

雨燕双飞 提交于 2019-12-03 00:55:17
问题 We are a medium-sized academic research lab whose main outputs are new statistical methods for analyzing large datasets. We generally develop in R and MATLAB/Octave. We would like to expand the reach of our work by building simple, wizard-style user interfaces to access our methods, either web-apps like RNAfold or stand-alone applications to analyze private data. Ideally, we would like the interfaces to do some data checking, to only use FOSS, to run in Mac and Windows environments, and to be

Display struct fields without the mess

北城以北 提交于 2019-12-02 23:44:26
I have a struct in Octave that contains some big arrays. I'd like to know the names of the fields in this struct without having to look at all these big arrays. For instance, if I have: x.a=1; x.b=rand(3); x.c=1; The obvious way to take a gander at the structure is as follows: octave:12> x x = scalar structure containing the fields: a = 1 b = 0.7195967 0.9026158 0.8946427 0.4647287 0.9561791 0.5932929 0.3013618 0.2243270 0.5308220 c = 1 In Matlab, this would appear as the more succinct: >> x x = a: 1 b: [3x3 double] c: 1 How can I see the fields/field names without seeing all these big arrays?

For loop with multiplication step in MATLAB

*爱你&永不变心* 提交于 2019-12-02 21:09:37
问题 Is there any way to use a for-loop in MATLAB with a custom step? What I want to do is iterate over all powers of 2 lesser than a given number. The equivalent loop in C++ (for example) would be: for (int i = 1; i < 65; i *= 2) Note 1: This is the kind of iteration that best fits for-loops, so I'd like to not use while-loops. Note 2: I'm actually using Octave, not MATLAB. 回答1: Perhaps you want something along the lines of for i=2.^[1:6] disp(i) end Except you will need to figure out the range