tags:

views:

30

answers:

1

Hi,

I have tried to display the matrix values in edit controls the following way:

 LrOut = num2str(Lr(:, :, currentPosition));
    LqOut = num2str(Lq(:, :, currentPosition));
    set(handles.txtLr, 'String', LrOut);
    set(handles.txtLq, 'String', LqOut);

where txtLq and txtLr are edit controls:

alt text

When the code above is executed the controls disappear: alt text

The Lq and Lr are m x n matrices where m and n are values from 1 to 8 and above so it would be useful if the values could be displayed in a scrollable edit control.

Does anyone know what could be the cause of the problem and how to modify the current code in order to display values correctly and enable scrolling when the size of text exceeds the control size?

Thank you.

+4  A: 

You have to set Max property of edit control to the number of lines.

set(handles.txtLr, 'Max', size(Lr,1));
set(handles.txtLq, 'Max', size(Lq,1));

I would also recommend you to take a look at UITABLE control to display the matrix. You can update the data with

set(handles.uitable1, 'Data', Lr(:, :, currentPosition))
set(handles.uitable2, 'Data', Lq(:, :, currentPosition))

Both will have slider on the right and on the bottom if data size exceed the control size.

yuk