You can't do the following:
str2double(get(handles.edit4,'string'))(str2double(get(handles.edit9,'string')));
Did you mean to add a space between the terms? If not and you want to access the nth index of this variable, keep reading.
Unlike other languages like JAVA, you can't immediately take the output of str2double and find the value at the nth index. You need to use a temporary variable to do this kind of indexing. See this example:
a = {'1' '2' '3'}
b = '2'
c = str2double(a)(str2double(b))
temp = str2double(a);
c = temp(str2double(b));
In your case, any string that will return a matrix should be stored in a temporary matrix.
temp = str2double(get(handles.edit4,'string'))
value = tempMat(str2double(get(handles.edit9,'string')));
If you have to extract a value using 2 edit text boxes frequently, consider making a simple function like this:
function Value = getValue(Handle1, Handle2)
Values = str2double(get(Handle1, 'string'));
Value = Values(str2double(get(Handle2, 'string')));
And whenever you want to get a value from a edit text box based on the index value of another text box, do this:
getValue(handles.edit4, handles.edit9)
Best Answer