ezgigurkan
asked on
Versatile Data Structure in MatLab
I need to plot multiple lines on an axis continuously, as in several lines might be drawn on an axis every time I push a button (I have my own simple GUI). The lines are not removed so lines are drawn on top of each other. The problem is that I need to keep certain variables associated with these lines, e.g.
- the handler (so that I can delete the line later on)
- 4-5 numbers
- 2 strings
- 3 vectors of various sizes (and the size of each vector might be different for different lines)
I'll have a button that should iterate through all the lines on the axis, access these variables associated with them and do calculations/delete lines/plot new ones. So I think I need an array of something but I don't know MatLab well enough. If that was Java I'd probably have to use a class, just to keep all these variables in one place.
If anyone knows about a good tutorial that'd be great. Or, if there aren't any such data structures in MatLab, what can I do to achieve what I'm trying to do?
Just to make it more clear, these lines represent Support Vector Machines (Regression). I need the variables for prediction when new data arrive. I'll be assessing different kernels and settings simultaneously.
Appreciate any help.
- the handler (so that I can delete the line later on)
- 4-5 numbers
- 2 strings
- 3 vectors of various sizes (and the size of each vector might be different for different lines)
I'll have a button that should iterate through all the lines on the axis, access these variables associated with them and do calculations/delete lines/plot new ones. So I think I need an array of something but I don't know MatLab well enough. If that was Java I'd probably have to use a class, just to keep all these variables in one place.
If anyone knows about a good tutorial that'd be great. Or, if there aren't any such data structures in MatLab, what can I do to achieve what I'm trying to do?
Just to make it more clear, these lines represent Support Vector Machines (Regression). I need the variables for prediction when new data arrive. I'll be assessing different kernels and settings simultaneously.
Appreciate any help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cheers guys...
You can put handles in both cells and structs. In the following I create a function handle, put it in a struct, then put both in a cell array.
>> a = @(x) 5*x;
>> a(5)
ans =
25
>> b = struct('x5', a, 'num', 10)
b =
x5: @(x)5*x
num: 10
>> b.x5(b.num)
ans =
50
>> c = {a,b};
>> c{1}(c{2}.x5(c{2}.num))
ans =
250
ASKER