How do i load dice faces in the gui for my dice??

3 ビュー (過去 30 日間)
Zayne
Zayne 2011 年 9 月 5 日
I have created a dice in my gui,but now I want it to disp a dice face for each roll,any suggetions? If I can just get a function that loads an image in gui I will be fine,because I know how to repeat that function. Any help is welcome thank you!
  1 件のコメント
Walter Roberson
Walter Roberson 2011 年 9 月 6 日
Isn't it cheating to load the dice ??

サインインしてコメントする。

採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 9 月 5 日
help imread
help imshow

その他の回答 (1 件)

Paulo Silva
Paulo Silva 2011 年 9 月 5 日
instead of loading dice faces you can just show the dots on a graph like this:
v=randi(6);
hold off
switch v
case 1
plot(2,2,'o')
case 2
plot(1,3,'o')
hold on
plot(3,1,'o')
case 3
plot(1,1,'o')
hold on
plot(2,2,'o')
plot(3,3,'o')
case 4
plot(1,1,'o')
hold on
plot(1,3,'o')
plot(3,1,'o')
plot(3,3,'o')
case 5
plot(1,1,'o')
hold on
plot(1,3,'o')
plot(3,1,'o')
plot(3,3,'o')
plot(2,2,'o')
case 6
plot(1,1,'o')
hold on
plot(1,3,'o')
plot(3,1,'o')
plot(3,3,'o')
plot(1,2,'o')
plot(3,2,'o')
end
set(get(gca,'children'),'MarkerFaceColor','k') %fill the dots
axis([0 4 0 4])
  3 件のコメント
Paulo Silva
Paulo Silva 2011 年 9 月 5 日
yes I did :( dammit, the spy function would work very good instead of the plot, less lines of code, silly me ;)
Zayne
Zayne 2011 年 9 月 6 日
Thanks for the help guys!!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSparse Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by