Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: displaying data in a uitable.
Replies: 1   Last Post: Dec 20, 2012 6:47 AM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 Barry Shaw Posts: 32 Registered: 2/16/12
Re: displaying data in a uitable.
Posted: Dec 20, 2012 6:47 AM
 Plain Text Reply

"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)

Date Subject Author
12/20/12 Barry Shaw
12/20/12 Barry Shaw

© The Math Forum at NCTM 1994-2018. All Rights Reserved.