From: AMK on
Is there a way to assign struct elements as input into functions or is this just needless syntax? I guess the only benefit would be that instead of clearing each variable separately, one could just use "clear temp".

%% Define the meter markings markings from the DTS - refer
dr1 = 26;
dc1 = 0;
dr2 = 2093;
dc2 = 0;
temp.delim = '\t';

%% Run Fiber import function
dts_meter.(sensor_id) = import_ORYX_dts_meter(path,temp.delim,dr1,dr2,dc1,dc2);

clear dc1 dc2 dr1 dr2 temp


??? Error: File: import_ORYX_dts_meter.m Line: 5 Column: 53
Unexpected MATLAB operator.
From: Steven Lord on

"AMK" <kennaster(a)gmail.com> wrote in message
news:3437277.370653.1268418773717.JavaMail.root(a)gallium.mathforum.org...
> Is there a way to assign struct elements as input into functions or is
> this just needless syntax? I guess the only benefit would be that instead
> of clearing each variable separately, one could just use "clear temp".
>
> %% Define the meter markings markings from the DTS - refer
> dr1 = 26;
> dc1 = 0;
> dr2 = 2093;
> dc2 = 0;
> temp.delim = '\t';
>
> %% Run Fiber import function
> dts_meter.(sensor_id) =
> import_ORYX_dts_meter(path,temp.delim,dr1,dr2,dc1,dc2);
>
> clear dc1 dc2 dr1 dr2 temp
>
>
> ??? Error: File: import_ORYX_dts_meter.m Line: 5 Column: 53
> Unexpected MATLAB operator.

The way you've done it looks fine ... the problem appears to lie inside the
import_ORYX_dts_meter.m function, not in the way you called it. Can you
show lines 1-10 of the file?

Actually, now that I think about it, if you've defined your function like:

function output = import_ORYX_dts_meter(mypath, temp.delim, dr1, dr2,
dc1, dc2)

then that is the cause of the problem. The identifiers you specify as the
names of the input and output arguments in the signatures of the functions
MUST be legal variable names, not expressions. In the example above,
temp.delim is an expression rather than a legal variable name, and that
would cause that error. If you try to type that into the MATLAB Editor, you
should see a red bar to the right of that line -- that indicates you've made
a serious error.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ