Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: displaying data in a uitable.
Posted:
Dec 20, 2012 6:47 AM
|
|
"Barry Shaw" <Barry@h.com> wrote in message <kaupf9$fta$1@newscl01ah.mathworks.com>... > Hi. > > Simplified version of my problem..... > If I have the variable 'cor' below, I can display it in a uitable using the following code. > >> cor = {[0.1 0.2];[0.1 0.2]}; > >> cor = cellstr(num2str(cell2mat(cor))); > >> uitable('Data',cor) > > I run into difficulties when I have 'cor' of the form > >> cor = {[0.1 0.2];[0.1 0.2 0.3]}; > or > >> cor = {[0.1 0.2];[0.1 0.2];'N/A'}; > > I can't figure out how to display this in uitable. Problem is either because (1) the doubles in each row are of different sizes, or (2) rows are of a different data type. > > Also, I could have 1000's of rows, so I don't really want to implement any loops. > > Any suggestions please? > > Thanks
Man! Played a little more and it turned out to be very easy in the end. >> cor = {[0.1 0.2];[0.1 0.2 0.3];'N/A'}; >> cellfun(@num2str,cor,'UniformOutput',false)
|
|
|
|