triforcely / Octave.NET

📈 More than cross-platform Octave process wrapper 🔬
MIT License
32 stars 7 forks source link

How Can I save my octave variable? #6

Closed bemoregt closed 5 years ago

bemoregt commented 5 years ago

Hi, @CptWesley , @triforcely

How Can I save my octave variable?

using Octave.NET;

double[][] bb; using(var oct1= new OctaveContext()) { oct1.Execute("pkg load image;");

  double[][] aa= oct1
  .Execute("peaks(64);")
  .AsMatrix();

  bb=aa;

}

Thanks ~!

from @bemoregt

bemoregt commented 5 years ago

HI, @CptWesley , @triforcely

?? --;

triforcely commented 5 years ago

https://octave.sourceforge.io/octave/function/peaks.html

If you call it without return argument, it will display a window with graphics but you want to get the matrix with values.

Try:

double[][] aa= oct1
  .Execute("x = peaks(64)")
  .AsMatrix();

Please note, that there is no ";" character at the end of the command.

bemoregt commented 5 years ago

Hi, @triforcely @CptWesley

Im met this error, What's wrong to me ?

using Octave.NET; using(var oct1= new OctaveContext()){ oct1.Execute("pkg load image"); oct1.Execute("x=peaks(64)"); oct1.Execute("save('aa.txt', x)");}

No Results

69ms Win32Exception: No such file or directory at bool System.Diagnostics.Process.StartCore (ProcessStartInfo startInfo) at bool System.Diagnostics.Process.Start () at Octave.NET.OctaveProcess..ctor (string octaveCliPath) at OctaveProcess Octave.NET.OctaveContext.<>c__DisplayClass2_0.<.ctor>b__0 () at T Octave.NET.Core.ObjectPooling.ObjectPool.GetObject () at void Octave.NET.OctaveContext.Initialize () at string Octave.NET.OctaveContext.Execute (string command, int timeout)

triforcely commented 5 years ago

You don't have octave in your PATH or

OctaveContext.OctaveSettings.OctaveCliPath

is incorrect.

bemoregt commented 5 years ago

HI, @triforcely @CptWesley

Then, How can I set the correct path to my MacOSX?

I've already installed octave (mac version).

Thanks. in advance~

triforcely commented 5 years ago

This question is not related to the Octave.NET, please refer to MacOSX documentation.