Filter löschen
Filter löschen

Undefined variable using evalin

2 Ansichten (letzte 30 Tage)
aldburg
aldburg am 25 Feb. 2018
Kommentiert: aldburg am 26 Feb. 2018
I'm trying to create a function where it returns the Temperature as a function of time from my data structure. I'm not sure where my syntax is wrong but I get an undefined varaible "Cure_Kinetics" or class "Cure_Kinetics.neat". In my Workspace, I already have the structure defined and Cure_Kinetics.neat(1).data(1,2) has a value assigned to that index.
function [ T ] = temp_program( data_file )
% Parameter inputs: i for each individual data file
% Grabs initial starting temp and ramp rate from ith data files
% Parameter outputs: Function for temperature
syms t
t_0 = evalin('base', Cure_Kinetics.neat(data_file).data(1,2));
beta = evalin('base', Cure_Kinetics.neat(data_file).ramp_rate(1,1));
T = (t_0 + t*beta);
end

Antworten (1)

Walter Roberson
Walter Roberson am 26 Feb. 2018
evalin(ws, expression) executes expression, a character vector or string scalar containing any valid MATLAB® expression using variables in the workspace ws
  3 Kommentare
Walter Roberson
Walter Roberson am 26 Feb. 2018
neat = evalin('base', 'Cure_Kinetics.neat');
t_0 = neat(data_file).data(1,2);
beta = neat(data_file).ramprate(1,1);
syms t
T = t_0 + t * beta;
aldburg
aldburg am 26 Feb. 2018
Thank you very much.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by