How to get a charachter vector from a cell array?
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!