octave

How to change toolkit in Octave?

三世轮回 提交于 2019-12-07 09:23:05
问题 My Octave crashes when I execute plot command. I found a solution in Assad Ebrahim's answer. He mentioned to switch the default toolkit to gnuplot , and change it in octave.rc file if I want to make the change permanently but I'm not clear about the permanent change in octaverc . When I open my octaverc with notepad++, it looks like this: ## System-wide startup file for Octave. ## ## This file should contain any commands that should be executed each ## time Octave starts for every user at

Loading hyperspectral images in Octave

旧时模样 提交于 2019-12-07 02:58:24
Using Matlab I can see the 4th channel of my image, but not with Octave: the following Matlab code for image (I) gives I =imread('../rec3/2012R_1_1.tif') [nr nc nb] = size(I); nb It gives out : nb = 4 where nb is the channel number and I is a 64 bit image(3057x1210) But for the same image Octave gives : nb = 3 Should I load any special package in order to be able to work with hyperspectral images? EDIT The output of the imfinfo for Octave: ans = scalar structure containing the fields: Filename = c:/2012R_1_1.tif FileModDate = 10-May-2016 20:02:10 FileSize = 23140500 Format = TIFF FormatVersion

Saving .fig file from Octave

丶灬走出姿态 提交于 2019-12-07 01:34:28
问题 I need to make a .fig file that can be reopened in Matlab, but I am working in Octave. But apparently there is no saveas command in Octave. This is what I am trying: octave:3> plot([1,2,3],[45,23,10]) octave:4> saveas(gcf,'myfig.fig') error: `saveas' undefined near line 4 column 1 octave:4> 回答1: Currently the Matlab fig file format is a proprietary binary file format. Octave doesn't know how to export to this format and won't be able to until it is reverse engineered. The fig format that

Numerical grouping using matlab / octave and not repeating values found in main array

懵懂的女人 提交于 2019-12-06 21:44:34
I have about 100,000 numbers that I would like to group together based on dividing by two or increments of two. PS: The increment values may change and the values found in the main array "x" can only be used once. I'm not sure how to check and stop the loop if a number in the "array_all" array has been repeated from the "x" array. See example below Example: x=[9,8,7,6,5,4,3,2,1] I'm trying to get the array_all array to look like this: array_all= [ 9.00000 4.50000 2.25000 8.00000 4.00000 2.00000 7.00000 3.50000 1.75000 6.00000 3.00000 1.50000 5.00000 2.50000 1.25000 1.00000 0.50000 0.25000] and

changing frequency using fft and ifft not using whole numbers

和自甴很熟 提交于 2019-12-06 21:20:06
问题 I know I can change frequency by whole numbers by changing the variable shift but how can I change the frequency using numbers with decimal places like .754 or 1.2345 or 67.456 . If I change the variable 'shift' to a non-whole like number like 5.1 I get an error subscript indices must be either positive integers less than 2^31 or logicals from line mag2s = [mag2(shift+1:end), zeros(1,shift)]; Example Code below from question increase / decrease the frequency of a signal using fft and ifft in

Convert vector into logical matrix?

匆匆过客 提交于 2019-12-06 19:27:14
问题 I have a vector y of length n. y(i) is an integer in 1..m. Is there a simpler way to convert y into an n x m logical matrix yy, where yy(i, j) = 1 if y(i) = j, but 0 otherwise? Here's how I've been doing it: % If m is known (m = 3 here), you could write it out all at once yy = [y == 1; y== 2; y == 3]; yy = reshape(yy, n, 3); or % if m is not known ahead of time yy = [ y == 1 ]; for i = 2:m; yy = [ yy; y == i ]; end yy = reshape(yy, n, m); 回答1: You can use bsxfun for this yy = bsxfun(@eq,y(:),

Send data by network and plot with octave

瘦欲@ 提交于 2019-12-06 16:55:16
I am working on a robot and my goal is to plot the state of the robot. For now, my workflow is this: Launch the program Redirect the output in a file (robot/bash): rosrun explo explo_node > states.txt Send the file to my local machine (robot/bash): scp states.txt my_desktop:/home/user Plot the states with octave (desktop/octave): plot_data('states.txt') Is there a simple solution to have the data in "real time"? For the octave side. I think that I can with not so much difficulty read from a file as an input and plot the data when data is added. The problem is how do I send the data to a file?

how to convert Matlab scripts in R

自闭症网瘾萝莉.ら 提交于 2019-12-06 15:36:06
I would like to run some Matlab scripts. Nevertheless we don't have the Matlab licence so it is necessary a conversion from Matlab to R language. Unfortunately I'm totally new in Matlab but not in R. Is it possible to read Matlab scripts using R or is there an easy way to translate Matlab scripts in R? Rewriting from one language to another can be a painstaking process, especially because your have to take great care that the outcomes of both sets of codes are the same. I see roughly four approaches: Digest the goal of the scripts, put aside the matlab code, and rewrite in R Try and mimic the

Scipy.linalg.eig() giving different eigenvectors from GNU Octave's eig()

自古美人都是妖i 提交于 2019-12-06 13:45:18
I want to compute the eigenvalues for a generalized eigenvalue problem with lambda * M * v = K * v, where lambda is the eigenvalue, v is an eigenvector, and M and K are matrices. Let's say we have K = 1.8000 + 0.0000i -1.0970 + 0.9550i -1.0970 - 0.9550i 1.8000 + 0.0000i M = 209 0 0 209 In Octave, if I do [V,D]=eig(K,M) , I get: V = 0.53332 - 0.46429i -0.53332 + 0.46429i 0.70711 + 0.00000i 0.70711 + 0.00000i D = Diagonal Matrix 0.34555 0 0 3.25445 However, if I do scipy.linalg.eig(K, b=M) using Scipy in python, I get a different result: >>> import numpy as np >>> import scipy as sp >>> import

Pass filename to windows batch (.bat) script when double clicking so that it will run in octave

天大地大妈咪最大 提交于 2019-12-06 13:42:31
I'm new in using batch scripts, and moderately experienced with octave. I have a lot of data files I examine with octave functions and I am trying to set up so that I can double click on files with a custom extension to directly open octave functions. Think "when I double click on this text file, it opens in notepad." To do this I've written a very basic .bat file and I've associated my .data files to open using this .bat file. The .bat file looks like this: C:\Octave\Octave-4.2.1\octave.vbs --no-gui --persist --eval myOctaveFunction.m pause I've tested it with a hard coded filename inside