octave

How do you create an Array<octave_idx_type> in an .oct file?

我怕爱的太早我们不能终老 提交于 2019-12-25 01:08:34
问题 I'd like to use the Array octave_idx_type as an index vector to insert a matrix into an NDArray ( see stackoverflow thread here ) as in A.insert( B , Array<octave_idx_type> ) ; where the array A is 3-dimensional. I know that I can use A.insert( B , 0 , 0 ) ; to insert into the first "page" but it is important that I be able to insert into the other pages of A in a loop, presumably by changing the idx_vector values for the page once in each loop. How do I create this idx_type array? 回答1: Hava

How do you create an Array<octave_idx_type> in an .oct file?

走远了吗. 提交于 2019-12-25 00:34:08
问题 I'd like to use the Array octave_idx_type as an index vector to insert a matrix into an NDArray ( see stackoverflow thread here ) as in A.insert( B , Array<octave_idx_type> ) ; where the array A is 3-dimensional. I know that I can use A.insert( B , 0 , 0 ) ; to insert into the first "page" but it is important that I be able to insert into the other pages of A in a loop, presumably by changing the idx_vector values for the page once in each loop. How do I create this idx_type array? 回答1: Hava

Octave/Matlab: min of two vectors

随声附和 提交于 2019-12-25 00:33:54
问题 Let's take two vectors: a = [1 ; 2; 3] b = [0 ; 9 ; -5] If I want minimum value of the vector and it's position I can simply: [x, ix] = min(a) I can also compare two vectors and get minimum values: > min(a, b) ans = 0 2 -5 But it is impossible to get positions of min values of two vectors: > [x, ix] = min(a, b) x = 0 2 -5 error: element number 2 undefined in return list Why? How to get them? Is there a simple method? 回答1: here's how to do that: [v id]=min([a,b]') 回答2: It's a matter of having

Octave can't find JRE while I have installed JRE

匆匆过客 提交于 2019-12-24 22:30:27
问题 I have installed JRE successfully: However, Octave keeps showing that it can't find JRE. 回答1: Following https://octave.1599824.n4.nabble.com/Octave-4-installer-doesn-t-detect-JRE-at-install-time-td4670684.html and: https://superuser.com/questions/1382158/on-windows-why-java-version-return-error-opening-registry-key-software-javas run regedit.exe as Admin change CurrentVersion in HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\ to 12.0.2 create: HKEY_LOCAL_MACHINE\SOFTWARE

Get vector indices before-and-after (window +/- 1) given indices

淺唱寂寞╮ 提交于 2019-12-24 20:58:51
问题 What's the best Matlab/Octave idiom, given idx a vector of indices, to get the sorted vector of idx +/-1 ? I have an n x 7 data matrix, column 3 is an integer label, and I'm interested in viewing the neighborhood of discontinuities on it. Hence I get the corresponding indices: idx = find(diff(data(:,3)) > 0) 5297 6275 6832 ... 20187 Then if I want to view that neighborhood +/- 1 on my column (e.g. on the (mx2) matrix [idx-1; idx+1] ), I need to form the vector of idx-1, idx+1 either

Sum of product each row by a matrix

爷,独闯天下 提交于 2019-12-24 20:53:48
问题 I have a matrix A and a three-dims matrix B . I want to sum (by i ) A(i,:)*B(i,:,:) , but without loops by i . 回答1: I'll start by creating some random matrices similar to what you described: n = 4; m =3; A = rand(n,m); B = rand(n,m,5); 1) loop version: C = zeros(1,size(B,3)); for i=1:n C = C + A(i,:)*squeeze(B(i,:,:)); end basically it performs matrix multiplication of each row of A by the corresponding slice of B , and accumulates the sum. This is could be slighty improved by permuting the

How does Octave spectrogram 'specgram' from signal work?

只愿长相守 提交于 2019-12-24 17:39:27
问题 I'm trying to test the specgram function located in the signal package in Octave but I'm a little confused at the input/output variables for specgram. What I would like to do is be able to get the specgram data into an array that will show the frequency and the length of time when the frequency starts and stops. See example code below: I was trying to get the array to show that for the length of t1 it will be 7hz, t2 will be 12hz and for t3 will be 2hz. How can I go about doing this? I'm

install octave *no root*, missing BLAS and LAPACK

只愿长相守 提交于 2019-12-24 14:12:45
问题 I am trying to install octave on my machine (Scientific Linux 6.4 based on red hat) without having root access. After running the following: ./configure CPPFLAGS="-I/some_stuff/user_name/bin/pcre-8.32/include" LDFLAGS="-L/some_stuff/user_name/bin/pcre-8.32/lib" (I had to install pcre apriori; before I got errors re: pcre), I get a message along the lines: configure: error: You are required to have BLAS and LAPACK libraries Now LAPACK has just been made in $HOME/bin/lapack-3.4.2 yet the same

running bash script from within octave / matlab getting error executing bash syntax error near unexpected token `('

本秂侑毒 提交于 2019-12-24 13:19:06
问题 I get the error executing bash syntax error near unexpected token `(' I know the error is caused by the ')' but I thought placing the commands in-between ' ' is suppose to allow the parenthesis in a directory name. How can I fix this without renaming the name? The matlab / octave code is: syscmd=strcat({'bash -c '},{''''},{'cd '},dirpathpls,newdirname,{' && exec bash xfade.sh'},{''''}) %used to run script to join files in stretch directory system(syscmd); and it produces what is below: bash

Plot 3D line on top of surface plot in Octave

﹥>﹥吖頭↗ 提交于 2019-12-24 11:53:27
问题 I have plotted a surface from some data. In the same plot I want to have a 3D line (I have the [x,y,z] values for the line I want to plot). When I try to do this using plot3(x,y,z) in the same figure, the line is always below the surface. Is there any way to fix this? I don't know if this problem appears in Matlab as well. Minimal example: figure; hold all; y = x = 0:35; z = ones(1,36).*0.5; plot3(x,y,z); [X,Y] = meshgrid(-8:.5:8); R = sqrt(X.^2 + Y.^2) + eps; Z = sin(R)./R; surf(Z); The