How to properly assigned to a variable vector of the cell?

Dear all,
I have variable xx and cell (velky). I want to choose one vector velky {2,a} (for example velky{2,1})of this cell and assigned to a variable xx. I try to do this, but withnout succes.
This is my code:
load ('testovaci_modely_velke_skvrny')
load ('net')
prompt = {'Napište číslo testovacího modelu:','z'};
dlg_title = 'Vytvoření vlastního testovacího modelu';
num_lines = 1;
x = inputdlg('Napište číslo testovacího modelu:','Vytvoření vlastního testovacího modelu', [1 100]);
a = x{1,1};
disp('Zadali jste správné číslo.')
xx = velky{2,a};
% Y = sim(net,P);
imdl= mk_common_model('a2c0',16);
img_1 = mk_image(imdl);
img_input = img_1;
img_input.elem_data = xx;
figure
show_fem(img_input);
title('Testovací model')
Does anyone have any idea? Thank you for your answers.

답변 (2개)

Image Analyst
Image Analyst 2015년 3월 12일
What does this show, after you get x and a:
whos x
x
whos a
a

댓글 수: 4

It shows images (figures). x is input (number of image), which user writes into the prompt. a is a variable, where x is saved and select image of the cell (second row and specific column a )
Just copy and paste what it says, don't paraphrase or interpret it - give us the actual output.
When I write to prompt 2 (number of figure). Comand Window returns this:
x =
'2'
a =
2
Zadali jste správné číslo.
x =
{}
Index exceeds matrix dimensions.
Error in BP_GUI2015>pushbutton3_Callback (line 533)
a = x{1,1}
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in BP_GUI2015 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)BP_GUI2015('pushbutton3_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
can you upload the mat file, and change the prompts to English and I'll try to run your exact code?

댓글을 달려면 로그인하십시오.

Veronika
Veronika 2015년 3월 13일

0 개 추천

Ok, there is m.file. I work with EIDORS, but I deal with vector and cell.

댓글 수: 2

Error using load
Unable to read file 'testovaci_modely_velke_skvrny'.
No such file or directory.
Error in test1 (line 1)
load ('testovaci_modely_velke_skvrny')

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

질문:

2015년 3월 12일

댓글:

2015년 3월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by