Matrix and tables fusion

조회 수: 1 (최근 30일)
Aziza Zaouga
Aziza Zaouga 2018년 8월 30일
댓글: Aziza Zaouga 2018년 8월 30일
Hello everyone, Is it possible to create a matrix with cell containing each, 2 values ( knowing that the number of rows and columns are fixed). For example, Mat is a Matrix with 4 rows and 5 columns and I want that Mat(i,j) is containing 2 values.
Thank you in advancd for your help
  댓글 수: 2
Greg
Greg 2018년 8월 30일
You've mixed matrix (assumedly meaning of a numeric type), cell, and table quite confusingly in your question.
What is your actual desired output data type? Do you have a preference, or does anything that nests 2 values suffice? What's your final goal - plot, arithmetic, print to file…? What you want to do with the variable can enforce a preference on its type.
Aziza Zaouga
Aziza Zaouga 2018년 8월 30일
In fact, I have 2 values to be inserted in the same cell of my Matrix and to be used in some calculations in my program.

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

답변 (1개)

Greg
Greg 2018년 8월 30일
Assuming a table output variable is acceptable:
Var1 = randi(99,10,2);
Var2 = randi(10,10,1);
T = table(Var1,Var2)
T(3,1) % Still of type "table"
T{3,1} % Now of type 2x1 "double"

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by