I have array_X
array_X=[1,1,1,0,1,0,0,0,1,0]
i want to change to
like this.
ans =
'1110100010'
how to change this?

 Akzeptierte Antwort

KSSV
KSSV am 10 Jun. 2020

0 Stimmen

k = num2str(array_X) ; % convert to string
k(k ==' ') = [] ; % remove spaces
There will be more other elegant ways.

Weitere Antworten (1)

Stephen23
Stephen23 am 10 Jun. 2020

1 Stimme

The most efficient solution is likely to be
>> X = [1,1,1,0,1,0,0,0,1,0];
>> A = sprintf('%u',X)
A = 1110100010

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Produkte

Tags

Gefragt:

am 10 Jun. 2020

Beantwortet:

am 10 Jun. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by