I would like to add commas between array values.
for example, I have a array A.
A = [1 2 3];
I would like to get a list of B from A.
B = [1, 2, 3];
How can I do this?

댓글 수: 4

KSSV
KSSV 2022년 6월 23일
You want to write B in text file? Why you want commas? What's the purpose?
병극 조
병극 조 2022년 6월 23일
Yes, I want to write B in text file.
Thank you.
Rik
Rik 2022년 6월 23일
Just to clarify: A is a Matlab variable, and B should be the char vector '[1, 2, 3]'?
병극 조
병극 조 2022년 6월 23일
no type change. I just want to put commas.
Thank you.

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

답변 (1개)

KSSV
KSSV 2022년 6월 23일

0 개 추천

A = [1 2 3] ;
dlmwrite('test.txt',A)

댓글 수: 2

병극 조
병극 조 2022년 6월 23일
This is what I want. Thank you very much.
KSSV
KSSV 2022년 6월 23일
Thanks is accepting/ voting the answer. :)

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

카테고리

도움말 센터File Exchange에서 Text Data Preparation에 대해 자세히 알아보기

제품

릴리스

R2021b

태그

질문:

2022년 6월 23일

댓글:

2022년 6월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by