Can I change this?

2 次查看(过去 30 天)
Younghun Kim
Younghun Kim 2020-6-10
回答: Stephen23 2020-6-10
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?

采纳的回答

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

更多回答(1 个)

Stephen23
Stephen23 2020-6-10
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

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by