Need help with uitable data input ... Urgent help is appreciated

i am getting a data in a variable which is like below
Value = {{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,2.203,2.203,2.203,1.500,1.102,1.102},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000}}
Actually this is a 2D table as shown in the below snap
which i am getting from function callback , i want to transfer this value to uitable but it accepts only cell array . HOw can i show the above table in gui uitable.
I am new to matlab so that is why i am asking this question.
thanks in advance.

2 Comments

What code are you using and what error are you getting? This is a cell array, although if it has a regular definition of equal numbers of rows and columns it really shouldn't be defined in even one cell array, let alone nested cell arrays.
If you can I would advise putting your data straight into a numeric array in the first place if it has such a regular structure.
Also, don't put 'Urgent' in a question title. Everyone's work is urgent to them, but not to anyone else. People help as and when they find the time and usually I ignore any questions that include words like "urgent" and I know it annoys many other regulars too.
First i would like to apologise writing urgent in the question ... Already i have mentioned i am new to matlab and to this community also . So i would appreciate your help if i would be able to solve the problem i am facing with your suggestions.
I a using the below code .
Value = {{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,2.203,2.203,2.203,1.500,1.102,1.102},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000},{2.000,2.000,0.797,1.000,1.000,1.000,1.000,1.000}}
set(handles.uitableFF , 'Data' ,value );

Sign in to comment.

 Accepted Answer

data = vertcat(Value{:});
This will give you a cell array of scalars, suitable for setting the Data property to.

3 Comments

Thank you soo much Walter this helps , and resolved my issue . really it was a much appreciated help
Walter one more thing As i am new to matlab GUI coding !! Can you guide me what to read to clear doubts and solve this type of issues in future working on my codes ?
thanks
This was one of those MATLAB aspects that you learn with experience, a way to make non-obvious portions of the language work together. The particular feature involved is named "list expansion" and I suggest searching for that as it also comes up with struct fields. There are blog posts about it.

Sign in to comment.

More Answers (1)

data = cell2mat( cellfun( @(x) cell2mat( x )', Value, 'UniformOutput', false ) )';
would convert your data into a numeric array if you really can't just put it in one in the first place. Then you should just be able to pass this to uitable.

Categories

Find more on Historical Contests in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!