MATLAB MATLAB GUI Edit text to Matrix

0 down vote favorite
share [g+] share [fb] share [tw]


Hi...I'm the beginner. I want to ask, how to put edit text to matrix? For example,
I have 30 edit text that will fill by number 0 - 1.
I want to make matrix x(1,1),....x(1,30) from the input of edit text.

I have tried this code :

function edit1_Callback(hObject, eventdata, handles)

% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double

x(1, 1) = str2double(get(hObject,'string'))


till....

function edit30_Callback(hObject, eventdata, handles)

% hObject handle to edit30 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit30 as text
% str2double(get(hObject,'String')) returns contents of edit30 as a double

x(1, 30) = str2double(get(hObject,'string'))

but, the command window show like this...

x =

1

x =

0 0

x =

0 0 0

x =

0 0 0 0.2500

x =

0 0 0 0 0.5000

x =

0 0 0 0 0 0

but actually I want the result is matrix, like

1 0 0 0.25 0.5 0

Does anyone know how to solve this problem?
 

Want to reply to this thread?

"MATLAB GUI Edit text to Matrix" You must log in or register to reply here.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top