how to make the cells of size (1*n) be shown in a cell array of size (m*n)?

조회 수: 2 (최근 30일)
Sarah A
Sarah A 2019년 1월 20일
댓글: Sarah A 2019년 1월 21일
Hello,
Suppose that I have the cell array C of size (3,5) that have these elements:
C= { 1x5cell; 1x5cell ;1x5cell}
where C(1,1)=
[0,1] [1,0] [1,1] [1,1] [0,0]
and C(1,2)=
[1,1] [1,0] [0,1] [0,0] [0,0]
and C(1,3)=
[1,0] [0,0] [0,1] [0,0] [0,1]
So, is there any way to make C shown in this way:
C=[
[0,1] [1,0] [1,1] [1,1] [0,0];
[1,1] [1,0] [0,1] [0,0] [0,0];
[1,0] [0,0] [0,1] [0,0] [0,1]
]
I hope that clear ! I attached the original matrix also.
  댓글 수: 2
dpb
dpb 2019년 1월 20일
If you mean in the default display in command window, no...(+)
You can always write a custom fprintf statement or little function to do so, however.
(+) It is theoretically possible, but would require rewriting/overloading builtin routines that would be for the purpose of the forum I believe, "out of scope"
Sarah A
Sarah A 2019년 1월 21일
No. I just want to make C.mat that I attached in the question to be similar to this matrix (Aug1).

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

답변 (1개)

Image Analyst
Image Analyst 2019년 1월 20일
Did you try celldisp()?
MATLAB displays how it displays. If you don't like it, you can't change it. It's pretty much fixed, except for things like how many decimal places or white space are shown, which you can adjust with the "format()" function.
If you want it formatted a certain way when you display it, you'd have to write your own function to use fprintf() to display it in a fashion that you want.
  댓글 수: 1
Sarah A
Sarah A 2019년 1월 21일
Thank you for your answer but this is not what I want. I just want the matrix C.mat to be similar to Aug1.mat.I attached them here.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by