Git Product home page Git Product logo

octave.net's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

octave.net's Issues

The graphical interface cannot be displayed

I run the following commands on Octave-GUI, everything works fine and shows a 3D pattern interface. If I execute with Octave.NET, there is no graphical interface displayed.

[x, y, z] = sphere (40);
surf (3x, 3y, 3*z);
axis equal;
title ("sphere of radius 3");

OctaveScriptError: error: sq_string cannot be indexed with

Hello I want Use it in My WebSite
so i print it to file
but it says 'OctaveScriptError: error: sq_string cannot be indexed with'
this is my code

var script = @"
x = -10:0.1:10;
y = sin (x);
handle = plot (x, y);
print('"+ uid + "'.png','-dpng') ";
 var a=   octave.Execute(script, int.MaxValue);

How do I use variables?

My requirement is to input a double array and then do FFT using Octave, but I don’t know how to give the input to Octave.
by the way FFT output format is complex , can i use AsVector(); ??

public static void FFT_Octave(double[] signal)
{
double fre, amp;

using (var octave = new OctaveContext())
{
    var input = octave.Execute(signal.ToOctave()); // [??????]

    var vectorResult = octave
        .Execute("fft(input)")
        .AsVector();
}

}

I've successfully tested below code in OSX.

Hi, @CptWesley @triforcely

I've successfully tested below code in OSX.
Compiled in VS for mac.

using System;
using System.IO;
using Octave.NET;

namespace ConsoleOctave1
{
class Program
{
static void Main(string[] args)
{
using (var octave = new OctaveContext())
{
octave.Execute("pkg load image;");
double[][] result = octave
.Execute("aa=peaks(256)")
.AsMatrix();// 10

            Console.WriteLine(result[1][1].ToString());

            StreamWriter sw1;
            sw1 = new StreamWriter("data.txt");
            for (int i = 0; i < 256; i++)
            {
                for (int j = 0; j < 256; j++)
                {
                    sw1.WriteLine(result[i][j].ToString());
                }
            }
            sw1.Dispose();

        }//using Octave
    }// method
}// class

}// namespace

And Now, I want saving image from octave.
How can I save my octave image using Octave.net?

The graphic cannot be displayed

I run the following commands on Octave-GUI, everything works fine and shows a 3D pattern interface. If I execute with Octave.NET, there is no graphical interface displayed.

[x, y, z] = sphere (40);
surf (3x, 3y, 3*z);
axis equal;
title ("sphere of radius 3");

Unable to run 'octave-cli' executable. Adding octave-cli path to the code.

Adding the bin folder to system path was working fine with me, but I need to use it through code for deployment purposes, but it won't work correctly with me, it always through an exception that I've added details below.

My usage goes like that

OctaveContext.OctaveSettings.OctaveCliPath = @"D:\InstalledPrograms\Octave\Octave-5.1.0.0\mingw64\bin\"; // add octave logic using (var octave = new OctaveContext()) { octave.Execute("pkg load image;");

I've tried to change the path several changes by adding the octave-cli file name with and without the .exe extension. i've copied the file into my project path, but failed in all nonetheless.

How to specify path to octave-cli binary in my code? I'm using .Net framework 4.7 and 4.6.1 in my project.

Thank you so much.

Exception:
{ "Message": "An error has occurred.", "ExceptionMessage": "Unable to run 'octave-cli' executable. Make sure that it exists and/or is added to environment PATH variable.", "ExceptionType": "System.Exception", "StackTrace": " at Octave.NET.OctaveProcess..ctor(String octaveCliPath)\r\n .... "InnerException": { "Message": "An error has occurred.", "ExceptionMessage": "The system cannot find the file specified", "ExceptionType": "System.ComponentModel.Win32Exception", "StackTrace": " at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)\r\n at Octave.NET.OctaveProcess..ctor(String octaveCliPath)" }

Octave 7.2.0

I have tested your solution with Octave 7.2.0 and you should know the application name 'octave-cli.exe' has changed to 'octave-launch.exe'. Also notice that 'octave-launch.exe' is now used for both GUI and CLI by using arguments:
GUI: "C:\Program Files\GNU Octave\Octave-7.2.0\octave-launch.exe" --gui
CLI: "C:\Program Files\GNU Octave\Octave-7.2.0\octave-launch.exe" --no-gui

  1. In OctaveGlobal.cs the application name is changed:

     private const string OctaveExecutable = "octave-launch";
    
  2. In OctaveProcess.cs the Arguments "--no-gui" is added:

         StartInfo = new ProcessStartInfo()
         {
             FileName = octaveCliPath,
             RedirectStandardInput = true,
             RedirectStandardOutput = true,
             RedirectStandardError = true,
             UseShellExecute = false,
             CreateNoWindow = true,
             Arguments = "--no-gui"
         };
    

Directly specify Octave executable

I was pleased to find this program, as it is exactly what I was searching for to solve a problem.

One issue I notice: the code works perfectly when I include Octave in my path. However, I do not think it is actually possible to specify the Octave executable through the code. This is because the OctaveContext creates the processPool item in its constructor, before anyone can have a chance to modify the OctaveSettings object. Perhaps it is possible to overload the constructor, and have an option to pass a customized OctaveSettings?

Does it support Octave 4.4.1 on Windows 7/10?

I am having trouble running the example project.
I have Octave 4.4.1 installed as I can't find the links for 4.4.0 and have added "C:\Octave\Octave-4.4.1\bin" to the System Path variable.
The path never gets loaded in the octave object and it's causing to throw an exception.
If I manually specify the path to the bin, the result is the same.

image

Library fails with "error: : all arguments must be strings" error message.

Hi, @CptWesley @triforcely

I met this error when run this code:

using (var octave = new OctaveContext())
{
// Note: your octave-cli must support some plot backend, in case of problems investigate manually in octave-cli

            var script = @"

x = -10:0.1:10;
y = sin (x);
filename= 'aa.txt';
save(filename, y);
handle = plot (x, y);

title (""Hello from C#"");
xlabel (""x"");
ylabel (""sin (x)"");

waitfor(handle); # <- without that plot window would not show
";
octave.Execute(script);
}

Error: "error: : all arguments must be strings\n"

What's wrong to me?

Thanks.

from @bemoregt.

if script include a function, will throw out error

Hi,all:
I have defined a function in script, like:
disp("Running...") function result = myrand(n, t, p, d) a = 200 * t + p; big_rand = a * n; result = big_rand / 10**d; return;endfunction mrand = myrand(5379, 0, 91, 4)

the script can correct execute in octave, but when call:
octave.Execute(script)
will show error : "error: 'myrand' undefined near line 1, column 9\r\n"

how defined a function in script? thanks

What about 6.x compatibility ?

Hi there,

I was wondering what would be the compatibility with the latest Octave 6.x releases (6.2.0 at the time of writing)?
Are breaking changes usually expected with major releases (in essence what happened to make it compatible with 5.x two years ago)?

Regards

I have met this error when run.

Hi, @CptWesley @triforcely

I have met this error when run.
"error: : all arguments must be strings\n"

What's wrong to me?

using System;
using System.IO;
using Octave.NET;

namespace ConsoleOctave1
{
class Program
{
static void Main(string[] args)
{
using (var octave = new OctaveContext())
{
octave.Execute("pkg load image;");
double[][] result = octave
.Execute("aa=peaks(256)")
.AsMatrix();// 10

            double[][] bb = octave
                .Execute("bb=aa.+1")
                .AsMatrix();// 10

            var cc = octave
                .Execute("f1='aa.mat'")
                .AsSpan();
                    
            var dd = octave
                .Execute("save(f1, bb);")    <------ Error occurs at here. ###########
                .AsMemory();// 10

            Console.WriteLine(bb[1][1].ToString());

            StreamWriter sw1;
            sw1 = new StreamWriter("data.txt");
            for (int i = 0; i < 256; i++)
            {
                for (int j = 0; j < 256; j++)
                {
                    sw1.WriteLine(bb[i][j].ToString());
                }
            }
            sw1.Dispose();

        }//using Octave
    }// method
}// class

}// namespace_

Thanks in advance.

Install problems

Hi, I am having issue installing from NuGet:

Severity Code Description Project File Line Suppression State
Error Could not install package 'Octave.NET 1.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.