Simple string and how to produce all possible combinations of numbers, letters and special characters
Afficher commentaires plus anciens
Hi everyone, I am facing some problem in using strings.
I want to produce all possible combinations of numbers,letters and special charactes.
for eg. a12,b12,c12,d12... 1a2,1a3,1a4,..1a9..1a, and so on and I want to pass these strings to some function in iterative for loop
If try to use for loop the problem will be as follows:
x='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz .,/<>?";:\|}]''{[=+-_)(*&^%$#@!~`';
for i=1:length(x)
for j=1:length(x)
Data='x(i)x(j)'
Data1=sprintf('%X',Data);
.....
.....
end
end
If i use for loop using 'x(i)x(j)' it will be considered as a single string. So for every loop it will produce same hex value!!
If I remove '' and only give x(i)x(j) it doesnt count as any data type and matlab will give error.
I want to use this Data1 hex value in another function , like this I want to increase the loop further to produce all possible strings with 3 places and 4 places and so on....
Please help me
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!