Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help needed in MATLAB programming

Status
Not open for further replies.

vanathidevi

Member level 2
Joined
Dec 27, 2006
Messages
43
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Location
India
Activity points
1,528
conversion to double from struct is not possible

hi,

i want to maintain array of structures in MATLAB
my variable name is file.

just i want to have
file(1)
file(2)
file(3)
file(4)

also file(1).fieldname
like thaT
is it possible in MATLAB?

i used the codeings

file(1)=struct;

but it says
Error using ==> double
Conversion to double from struct is not possible.

plz help me

thank you frds

with thanks n regards
vanathi

Added after 2 hours 47 minutes:

file(1)=struct('flow','e1','w','2.2','v','0','lp','1215','ron','1','count','5','pktsent','0','c','0','f','0','s','0','id','1','active','1');


is this the format is correct?
in matlab help this format is given.
can i initialize them like in C?

if the above format is given
error is
Error using ==> double
Conversion to double from struct is not possible.

plz help me

thanks n regards
vanathi
 

If you give this format ...
file(1)=struct('flow','e1','w','2.2','v','0','lp','1215','ron','1','count','5','pktsent','0','c','0','f','0','s','0','id','1','active','1')

u will get the following result..........
file =

flow: 'e1'
w: '2.2'
v: '0'
lp: '1215'
ron: '1'
count: '5'
pktsent: '0'
c: '0'
f: '0'
s: '0'
id: '1'
active: '1'

because in Matlab

S = STRUCT('field1',VALUES1,'field2',VALUES2,...) creates a
structure array with the specified fields and values.....

Type
Code:
help struct
in command window to get more information..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top