フィルターのクリア

How to convert 16 X 2 char into a String?

3 ビュー (過去 30 日間)
Kushal Khaitan
Kushal Khaitan 2013 年 2 月 3 日
I have a 16x2 char. the values are:
69
C4
E0
D8
6A
7B
04
30
D8
CD
B7
80
70
B4
C5
5A
I want it as 69C4E0D86A7B0430D8CDB78070B4C55A
what should be the code plz help.
[EDITED, Jan, string fomatted]
  3 件のコメント
Kushal Khaitan
Kushal Khaitan 2013 年 2 月 3 日
This is the input : '69' 'C4' 'E0' 'D8' '6A' '7B' '04' '30' 'D8' 'CD' 'B7' '80' '70' 'B4' 'C5' '5A'
Jan
Jan 2013 年 2 月 4 日
@Kushal Khaitan: Do you see that we are wildly guessing what your input could be exactly? This wastes your and our time. It is more efficient, if you post the format of your input data in a valid Matlab syntax. The type and class of your input is still not well defined. Is it a cell string? Then this would have cleared this immediately:
data = {'69' 'C4' 'E0' 'D8' '6A' '7B' '04' '30' 'D8' 'CD' 'B7' '80' '70' 'B4' 'C5' '5A'}

サインインしてコメントする。

回答 (4 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 3 日
編集済み: Azzi Abdelmalek 2013 年 2 月 3 日
x='69 C4 E0 D8 6A 7B 04 30 D8 CD B7 80 70 B4 C5 5A';
x(regexp(x,' '))=[]
  2 件のコメント
Kushal Khaitan
Kushal Khaitan 2013 年 2 月 3 日
This is not working
Jan
Jan 2013 年 2 月 3 日
編集済み: Jan 2013 年 2 月 3 日
Before the formatting, the question looked like:
69 C4 E0 D8 6A 7B 04 30 D8 CD B7 80 70 B4 C5 5A
and the REGEXP approach would be reasonable. But then this would be more efficient:
x(x==' ') = [];
However, after the formatting it gets clear, why the title claims the data have the size 16 x 2.
As I've said before: The formatting in this forum is not intuitive, although it is a very important feature.

サインインしてコメントする。


Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 3 日
Ok, I did not read your edit, try this
x='69 C4 E0 D8 6A 7B 04 30 D8 CD B7 80 70 B4 C5 5A';
x=regexp(x,' ','split')
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 3 日
編集済み: Azzi Abdelmalek 2013 年 2 月 3 日
I think I've not understood, the reverse is
y=char(x)';
out=y(:)'

サインインしてコメントする。


Walter Roberson
Walter Roberson 2013 年 2 月 3 日
x = {'69' 'C4' 'E0' 'D8' '6A' '7B' '04' '30' 'D8' 'CD' 'B7' '80' '70' 'B4' 'C5' '5A'};
y = horzcat(x{:});

Jan
Jan 2013 年 2 月 3 日
編集済み: Jan 2013 年 2 月 3 日
Without a proper formatting, the structure of your input is not clear. Did you recognize this?
x = ['69'; ...
'C4'; ...
'E0'; ...
'D8'; ...
'6A'; ...
'7B'; ...
'04'; ...
'30'; ...
'D8'; ...
'CD'; ...
'B7'; ...
'80'; ...
'70'; ...
'B4'; ...
'C5'; ...
'5A'];
s = reshape(transpose(x), 1, []);

カテゴリ

Help Center および File ExchangeNumeric Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by