David Moreno
David Moreno

Reputation: 1

Error with oct2py when the octave function have load param

I'm using oct2py to call a octave function in my python code. Everything should be OK, and the octave function exectuted with octave works but when I call the function with python I have this error:

import os

pathToExecutable = ('C:\\Octave\\Octave-5.2.0\\mingw64\\bin\\octave-cli.exe')
os.environ['OCTAVE_EXECUTABLE'] = pathToExecutable

from oct2py import octave
import pprint
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import loadmat

octave.addpath(octave.genpath('E:/funcs/software/octave_calls'))
octave.eval('MSPP')

Oct2PyError: Octave evaluation error: error: 'AvgPwr' undefined near line 22 column 15 error: called from: MSPP at line 22, column 8

The octave code in this line is the next:

Power=AvgPwr

When AvgPower is defined when I import it from a .mat file with

load params.mat %<--transcription corrected (before it was load(params.mat)

EDIT:

First lines of MSSP.

warning off
close all;
clear all;
clc;

%% Load pameters

load params.mat
  
################################################################################

%% CW Laser

Plaser = 10^((AvgPwr-30)/10);         % Average Laser Power
emzm = 1.0;

params.mat is generated in another octave file where I load all parameters and it contains the variable AvgPwr, I think it's everything correct with the octave code because it works well when I use octave to run it.

Upvotes: 0

Views: 567

Answers (0)

Related Questions