|
harrison fast wrote:
> I am getting an index exceeds matrix dimensions error I do not understand.
>
> Here is the code in question:
>
> prompt = {'Enter element number:'};
> dlg_title = 'Element input for strain calculation';
> num_lines = 1;
> def = {'1'};
> global answer;
> answer = inputdlg(prompt,dlg_title,num_lines,def);
> xl = answer{1};
> disp(['The strain on element ' answer{1} ' is: '])
> disp(num2str(strain_output(xl,2)));
>
> I am inputting 1 while strain_output is 2x3 and I still receive this
> error. I assume it has something to do with answer being a cell array
> but I have no idea how to fix it. Any help is greatly appreciated. Thanks.
xl = str2num(answer{1}); % inputdlg returns string, not numeric value
--
|