필터 지우기
필터 지우기

Trying to make a table with 21 rows, 4 colums

조회 수: 4 (최근 30일)
Kathryn Dowling
Kathryn Dowling 2020년 5월 1일
답변: Cris LaPierre 2020년 5월 1일
I am trying to make a table that has 21 rows and 4 columns, as shown in the picture below. So I have done all the calculations with the variable names but I can't figure out how to get them into a table form. I am using Matlab 2020a
  댓글 수: 2
Tommy
Tommy 2020년 5월 1일
What does your code look like so far? You can make a table like this:
T = table(var1,var2,var3,var4, 'VariableNames', {'col1name','col2name','col3name','col4name'});
where var1, var2, var3, and var4 are your four column vectors (each of which should have 21 rows).
For example,
>> T = table((1:10)',('a':'j')', 'VariableNames', {'numbers', 'letters'})
T =
10×2 table
numbers letters
_______ _______
1 a
2 b
3 c
4 d
5 e
6 f
7 g
8 h
9 i
10 j
Adam Danz
Adam Danz 2020년 5월 1일
If your data is already within a cell array, check out cell2table

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

답변 (1개)

Cris LaPierre
Cris LaPierre 2020년 5월 1일
Based on what I see in your image, consider revising how you want to put this in a table. Why?
  1. Each column in a table is a variable. That is the column in your image.
  2. You can add units as a property of a table variable. That is the 3rd column in your image
  3. You can add a description to a table variabe. That is the 4th column in your image.
See this doc page for more info and details.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by