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 Kommentare

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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 23 Jun. 2022

0 Stimmen

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

2 Kommentare

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

Melden Sie sich an, um zu kommentieren.

Kategorien

Produkte

Version

R2021b

Tags

Gefragt:

am 23 Jun. 2022

Kommentiert:

am 23 Jun. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by