How to get a charachter vector from a cell array?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Samuel Augustiny
il 16 Lug 2018
Modificato: Adam Danz
il 16 Lug 2018
I used to have a charachter vector like:
bound = ['c', 'f', 'f', 'f'];
And I got:
bound(1) = 'c'
bound(2) = 'f'
but then I needed to change it and have right now:
bound = ['ctb', 'f', 'f', 'f'];
but if I want to acces bound(1) I get just:
bound(1) = 'c'
But I need:
bound(1) = 'ctb'
So I thought i can use cells instead of char so i changed my code:
bound = {'ctb', 'f', 'f', 'f'};
And I get also
bound(1) = 'ctb'
But this is no more a character vector and I can't use it with mkdir to create folders. If you convert
char(bound)
you get an character array instead of a character vector. Also
strcat(bound)
remains a cell array. So how can I use mkdir with cell arrays or convert cell arrays to character vectors?
Just for clarification I use it late like this where numa, tnm, lxnum, npnum, stiffnum are integers and method is also a character vector:
nameap = [num2str(numa),'-',num2str(tnm), ...
'-',num2str(lxnum),'-',num2str(npnum), ...
'-',num2str(stiffnum),'-',strcat(bound),'-',method]; %Appendix of folders and files
simfol = ['sim-',nameap]; %simulation folder name
mkdir(char(simfol)); %Create folder for the simulation
Ans I use R2016b.
0 Commenti
Risposta accettata
Adam Danz
il 16 Lug 2018
Modificato: Adam Danz
il 16 Lug 2018
bound = {'ctb', 'f', 'f', 'f'};
bound(1) % {'ctb'}, cell
bound{1} % 'ctb', char
bound{1}(1) % 'c', char
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Encryption / Cryptography in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!