Cell and String manipulation
Ältere Kommentare anzeigen
Hi, I have A= <900x1> cell The cell contents are as follows:
AA
BB
CC
AA
BB
CC
.
.
.
1) I need to separate the above into blocks of 300. i.e. change the first 300 into the following:
AA1
BB1
CC1
...
Then the next 300 to AA2 BB2 CC2
And the following 300 to
AA3
BB3
CC3
2)So now I have A = {AA1} {BB1} {CC1} {AA1} {BB1} {CC1}... {AA2} {BB2} {CC2} i.e. I have sets of AA*, BB*, CC* that repeat. The first 300 have a suffix of 1, and so on..
I have thus 300 CCs. I have another variable h = 300x1 which is made up of ones and zeros.
h = [ 1 0 1 ...]
i.e. every CC in A has a corresponding h
I need to do the following
if h = 1, then the set (AA*,BB*,CC*) preceding the corresponding CC become AA1c, BB1c, CC1c.
if h = 0, then the set preceding the corresponding CC become AA1ic, BB1ic, CC1ic
So A = {AA1c} {BB1c} {CC1c} {AA1ic} {BB1ic} {CC1ic}... {AA2c} {BB2c} {CC2c}
I am not sure if I managed to convey the issue here so please let me know if I hav'nt and I will try to better explain.
Thank you.
Akzeptierte Antwort
Weitere Antworten (2)
susan
am 11 Sep. 2012
3 Kommentare
Sean de Wolski
am 11 Sep. 2012
sort()
susan
am 11 Sep. 2012
John Petersen
am 21 Nov. 2012
Bearbeitet: John Petersen
am 30 Nov. 2012
the value of h is already embedded in the AA's, BB's, etc. so why do you need h anymore?
susan
am 11 Sep. 2012
0 Stimmen
Kategorien
Mehr zu Hardware Discovery and Setup finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!