How to insert a structure into a function in matlab -


i writing matlab function :

function [resultnorm]= exploreffort (n, loop, step) ... somelines ... m=bench(a,b).y ; end 

but seems matlab compiler doesn't let me use structure in function, error is:

error: file: exploreffort.m line: 20 column: 15 functions cannot indexed using {} or . indexing. 

p.s: bench definition

bench =   24x5 struct array fields:  application dataset mica micanorm db y 

could mention how gonna able fix that?

method-1

there possibility define structure (namely here, bench) global outside file , call global bench; right before first appearance of bench.

method-2

the safer choice passing structure among input argument of function :

function [resultnorm]= exploreffort (n, loop, step, `bench`) 

in case no need prior unnecessary globalization.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -