I have an array that I want to display in a table in matlab app designer

조회 수: 6 (최근 30일)
Katherine
Katherine 2023년 12월 5일
댓글: Dyuman Joshi 2023년 12월 6일
So I have a function that produces a 1x2 array and a double
I want to create a table that displays the double in the first cell and in the cell below displays the array
e.g Imagine the lines are the table lines
| 82 |
______
| [ 1 2 ] |

답변 (1개)

Shreshth
Shreshth 2023년 12월 6일
Dear Katherine,
I understand that you are trying to create a table in MATLAB where the first cell contains a double and the cell below it contains a 1x2 array.
You can use the below method for the same:
  1. Initialize the variables with the double and the 1x2 array.
  2. Create a cell array to store these variables.
  3. Convert the cell array to a table using the cell2table function.
  4. Use the VariableNames property to name the columns if needed.
Here is a sample MATLAB code that demonstrates how to do this:
% Sample data
myDouble = 3.14; % This is the double
myArray = [1, 2]; % This is the 1x2 array
% Create a cell array to hold the double and the array
data = {myDouble; myArray};
% Convert the cell array to a table
myTable = cell2table(data, 'VariableNames', {'Values'});
% Display the table
disp(myTable);
Values __________ {[3.1400]} {[ 1 2]}
  댓글 수: 1
Dyuman Joshi
Dyuman Joshi 2023년 12월 6일
You seem to have misunderstood the question. The output is to be displayed in a UITable in an App.
It is not asking to display a table array.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by