Get value from excel file
이전 댓글 표시
Hi. I random the images into the axes already now. In the excel file I have list the file image name with the image names in the next column. I would like to get the image name in the second row from the excel file and display it in the textbox. For example if I get P1.jpg it will display rock but if I get P2.jpg it will display paper. Can someone please help me? Thank you.
images = {'P1.JPG','P2.JPG','P3.JPG','P4.JPG','P5.JPG','P6.JPG','P7.JPG','P8.JPG','P9.JPG','P10.JPG','P11.JPG','P12.JPG','P13.JPG','P14.JPG','P15.JPG','P16.JPG','P17.JPG','P18.JPG','P19.JPG','P20.JPG','P21.JPG','P22.JPG','P23.JPG','P24.JPG','P25.JPG','P26.JPG','P27.JPG','P28.JPG','P29.JPG','P30.JPG','P31.JPG','P32.JPG','P33.JPG','P34.JPG','P35.JPG','P36.JPG','P37.JPG','P38.JPG','P39.JPG','P40.JPG','P41.JPG','P42.JPG','P43.JPG','P44.JPG','P45.JPG','P46.JPG','P47.JPG','P48.JPG','P49.JPG','P50.JPG','P51.JPG','P52.JPG','P53.JPG','P54.JPG','P55.JPG','P56.JPG','P57.JPG','P58.JPG','P59.JPG','P60.JPG','P61.JPG','P62.JPG','P63.JPG','P64.JPG','P65.JPG','P66.JPG','P67.JPG','P68.JPG','P69.JPG','P70.JPG','P71.JPG','P72.JPG','P73.JPG','P74.JPG','P75.JPG','P76.JPG','P77.JPG','P78.JPG','P79.JPG','P80.JPG','P81.JPG','P82.JPG','P83.JPG','P84.JPG','P85.JPG','P86.JPG','P87.JPG','P88.JPG','P89.JPG','P90.JPG','P91.JPG','P92.JPG','P93.JPG','P94.JPG','P95.JPG','P96.JPG','P97.JPG'};
ix = randi([1,97]);
imagedata = images{ix};
imshow(imagedata);
[num,namePic,raw] = xlsread('DB.xls');
댓글 수: 2
Image Analyst
2017년 2월 5일
You forgot to attach db.xlsx, so I doubt people are going to do much to help you until then. In the meantime, learn how to access cell arrays by reading the FAQ.
Jitti Somsiri
2017년 2월 6일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!