In GUI environment I wanna assign the value of data which is double to listbox as appear below.

data = 1.0e+03 * 8.764479999999999 9.453410000000000 9.163520000000000 9.177770000000001 9.062700000000001 9.524580000000000
Name Size Bytes Class Attributes
data 3x2 48 double global
In GUI, there is a listbox so I wanna put data values in this listbox as 3x2 matrix size.

 Accepted Answer

data = 1.0e+03 * [8.764479999999999 9.453410 9.163520 9.177770000000001 9.062700000000001 9.52458]
for k = 1 : length(data)
cellArray(k) = {num2str(data(k))};
end
selectedItem = listdlg('ListString', cellArray)
Or, if you're using GUIDE
set(handles.listbox1, 'String', cellArray);

2 Comments

I appreciate for your answer but the second column of matrix isn't appear in listbox. data=[8.764 9.453;9.163 9.177;9,062 9.524] for this matrix only 8.764 9.163 9.062 values which is first column are appear. How can I assign second column with first column together?
What second column? You didn't show a second column (at least in your original question). Did you not format your question properly?
To show multiple columns you need a uitable, not a listbox.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!