Filter löschen
Filter löschen

Transforming 100x4 Char Array to 1x400 Char Array

1 Ansicht (letzte 30 Tage)
tinkyminky93
tinkyminky93 am 7 Jun. 2022
Kommentiert: KSSV am 7 Jun. 2022
Hello,
I have a char array with the dimensions of 100x4 and because it contains blank elements, in other words 4 charactered space ' ', I want to merge these elements and delete these 4 charactered blank elements. How can I do it? Thank you.
  2 Kommentare
Rik
Rik am 7 Jun. 2022
If you want to remove elements, this will change the number of elements, so any column vector will not have 400 elements.
It sounds like you should be using a cellstr (a cell array with char vectors) or the string data type.
tinkyminky93
tinkyminky93 am 7 Jun. 2022
Bearbeitet: tinkyminky93 am 7 Jun. 2022
That is what I want sir, i will remove them because it does not contains any information.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

KSSV
KSSV am 7 Jun. 2022
You have varities of functions to achieve this.
Try:
str = str(find(~isspace(str))) ; % where str is your string
  5 Kommentare
Rik
Rik am 7 Jun. 2022
I don't understand your source data. With a 2x6 char array as an input, you don't get the cell array output with the code KSSV posted. So I can't post the full processing.
Regarding the merging:
str={'0E';'F9'}
str = 2×1 cell array
{'0E'} {'F9'}
[str{:}]
ans = '0EF9'
KSSV
KSSV am 7 Jun. 2022
@tinkyminky93 why don't you attch your data, so that we can have a look and help you.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Identification finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by