Why is my table displaying "1 x 1 table" instead of the actual values

조회 수: 27 (최근 30일)
Camille F
Camille F 2022년 3월 21일
답변: Peter Perkins 2022년 3월 24일
Hi guys,
I have a matrix with 400 rows and 6 columns, let's call it "matrix 1".
I want to create a table from "matrix 1" but I want each column of my new table to be the values of 20 rows of column 4 of "matrix 1" (row 1 to 20 in the 1st column; row 21 to 40 in the 2nd column etc), I used this code :
table_matrix1=table(matrix1(1:20, 4),matrix1(21:40, 4),matrix1(41:60, 4))
As a result I get a table which is only displaying "1 x 1 table" in each cell and not the actual values of these cells, and I'd like to create an excel file from this output which is not working... Do you have an idea of what I could do differently to obtain a table with the actual numeric values?
Thanks a lot!
  댓글 수: 1
Ive J
Ive J 2022년 3월 21일
Share your matrix and script you're using. I cannot replicate this behavior:
x = rand(400, 6);
tab = table(x(1:20, 4), x(21:40, 4),x(41:60, 4));
head(tab)
ans = 8×3 table
Var1 Var2 Var3 _________ _______ _________ 0.79904 0.66279 0.62041 0.92164 0.34129 0.78888 0.87002 0.14161 0.62366 0.4431 0.53345 0.89308 0.0011616 0.30561 0.0031691 0.00593 0.59151 0.096618 0.36428 0.30117 0.033949 0.061849 0.55831 0.748

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

답변 (1개)

Peter Perkins
Peter Perkins 2022년 3월 24일
It may be that your matrix1 is not a numeric matrix, but rather is itself a table. You have not provide enough information for anyone to help you.

카테고리

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