I have to create blackjack for a exercise and I had to come up with a way to assign cards a numerical value. I therefore have made a "deck" of 52 cells, each cell being 1 x 2 containing an image(rgb) and a numerical value which matches that card e.g. 2 of hearts = 2. The issue im having is Matlab won't let me select the image via imshow out of the cell.
deckcan =
Columns 1 through 9 {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell}Columns 10 through 18 {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell}Columns 19 through 27 {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell}Columns 28 through 36 {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell}Columns 37 through 45 {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell}Columns 46 through 52 {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell} {1x2 cell}
I'm getting this error
>> >> imshow(deckcan{1}(2)) Error using imageDisplayValidateParams Expected input number 1, I, to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64, logical
Instead its type was cell.
Error in imageDisplayValidateParams (line 11) validateattributes(common_args.CData, {'numeric','logical'},…
Error in imageDisplayParseInputs (line 78) common_args = imageDisplayValidateParams(common_args);
Error in imshow (line 219) [common_args,specific_args] = …
The image is the first element of the cell.
Ultimately i want to use it in a for loop i have made to select a random card out of the deck.
Best Answer