How do I turn a string into a matrix but have each character in the string in a different cell?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Zachary Fancher
am 27 Nov. 2017
Bearbeitet: Stephen23
am 27 Nov. 2017
So I'm trying to make a password checker for my programming final and its supposed to take an input from the user and test it for all these requirements. So my password that meets all the requirements is Ab1@cd and I want the make it so that is stored as a matrix like this [A b 1 @ c d]. Ive tried several different things but still cant get it to do what I want. Please help :(
0 Kommentare
Akzeptierte Antwort
Sammit Jain
am 27 Nov. 2017
Here, I think this should do what you want to do. Actually MATLAB by default stores a string such that you can reference it by indices. Here's something that will do the job:
mystring = 'Ab1@cd';
myMat = mystring(:);
%Using the colon(:) will list out all elements in the string, and you're putting that list into a matrix
Hope this helps. Cheers.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!