# How can get Uipanels to display a vector? Or even just a scalar value(wich then can be implemented into a loop?

12 views (last 30 days)
So im looking for a way to use the uipanel function to display a 1xn vector (n ranging from 2:6), so that that inturn can communicate with checkboxes to create an interactive menu.
Here is my code creating the panels w checkboxes:
sides = 6
dice = 6
t = terning(sides,dice);
p = uipanel('Title','Dicethrow','FontSize',18,...
'BackgroundColor','white',...
'Position',[.001 .001 .999 .999]);
sp = uipanel('Parent',p,'Title','Choose Dice','FontSize',12,...
'Position',[.001 .001 .999 .999]);
cp = uipanel('Parent',sp,'Title','Done?','FontSize',8,...
'Position',[.50 .01 .08 .09]);
c = uicontrol('Parent',cp,'String','Done',...
'Position',[001 001 36 18]);
b = length(t);
for a = 1:b
v = 500.*(a/b);
h = 200;
s = 15;
c = uicontrol('Parent',p,'style', 'checkbox',...
'String','', 'Value', 0,...
'Position',[v h s s]);
end
terning is here a function creating a random dicethrow consiting of sides(determining what kind fo dice it is) and dice(what number of dice is being thrown)
The function looks like this:
function [result] = terning(d,ant)
%TERNING Playing a random number of same sided dice
% Creating a result vector for the played dice. Taking the inputs d and
% ant to determine what results we get when we play ant d-sided dice.
result = randi(d,1,ant);
end
So what i want is for my uipanel figure to in som way display the result vector that is created by my terning function.
Is this possible?

R2020a

### Community Treasure Hunt

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

Start Hunting!