help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Want to know how to inluce octave fft lib in my Qt program


From: Prasanth N P
Subject: Re: Want to know how to inluce octave fft lib in my Qt program
Date: Thu, 10 Oct 2013 14:59:30 +0530

Sorry for the inconvenience.

I checked the example and corrected code as like this.


  fp = fopen("buffer","r");
  if (fp == NULL)
  return 0;
  for (ucI=0;ucI< 1024;ucI++)
  fscanf(fp,"%d\n",&InData[ucI]);


  octave_main (2, argv.c_str_vec(), 1);


  Matrix a_matrix = Matrix (1, 1024);


  for (int i = 0; i < 1024; i++)
  {
      a_matrix (i) = InData[i];

  }

  octave_value_list in = octave_value (a_matrix);
  octave_value_list out = feval ("fft", in, 1024);

 
  std::cout <<  out.length() << "\n";


But got error error: octave_base_value::array_value(): wrong type argument `complex matrix'

How to extract these values to an array?





On Wed, Oct 9, 2013 at 2:48 PM, c. <address@hidden> wrote:
Hi,

Please do not top post, i.e., add your replies to the end of the message
instead of the top as it makes it easier for others to follow the conversations.


>>> On 7 Oct 2013, at 08:40, Prasanth N P <address@hidden> wrote:
>>>
>>> > Hi,
>>> > Hi,
>>> > I want to know how to use the fft function in octave in my qt program. Currenly I have a set of samples and want to do the fft of these with octave fft function. How can I do this?
>>> --
>>> Thanks & Regards,
>>> Prasanth NP
>>
>> On Mon, Oct 7, 2013 at 6:34 PM, c. <address@hidden> wrote:
>>
>> Octave's fft function is just a wrapper for the fftw library [1],
>> so if you have a C/C++ program it's probably easier for you to
>> use fftw directly.
>>
>> HTH,
>> c.
>>
>> [1] http://www.fftw.org/
>>
>>
> On 9 Oct 2013, at 10:23, Prasanth N P <address@hidden> wrote:

>
> But i have to use the ellip filter too in this  case, If I use the seperate lib of fftw, I have to find the seperate filter function also. So it is better to use the octave lib. Here is my problem
>
> I have to use those computation in my qt program. But currently I made this through system call
>
> myprogram.cpp
>
>        system("octave -qf shellLof.m");
>
>
> shellLof.m
>
>         load 'Data'
>         setenv ("GNUTERM", "x11")
>         t=1/SF;
>         l=2048;
>         v=fft(Data,l)/l;
>         V = v(1:l/2);
>
>         save fftdata V;
>
>
> Finally 'fftdata' file loaded in the myprogram.cpp. Can I use the fft function of octave without calling this shell program?
> --
> Thanks & Regards,
> Prasanth NP

Yes,

you can use the function "feval" to invoke the Octave interpreter from within a C++ application,
there is an exemple of how to do this inside the Octave source tree, look for the file named

  examples/embedded.cc

HTH,
c.



--
Thanks & Regards,
Prasanth NP


reply via email to

[Prev in Thread] Current Thread [Next in Thread]