To create zeros according to the length
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
fyza affandi
am 3 Dez. 2018
Beantwortet: ahmed nebli
am 3 Dez. 2018
I have array named lengthcode
lengthcode = [1 3 3 4 4 5 5 5 6 6]
From the lengthcode I want to create a zero number based on the lengthcode.
The result should be like this
result =[0 000 000 0000 0000 00000 00000 00000 000000 000000]
It is possible?
0 Kommentare
Akzeptierte Antwort
ahmed nebli
am 3 Dez. 2018
I don't think you can put numérical zeros ( 00000 will be 0 if so), therefore you need to write these zeros as a string.
i suggest you write a for loop de pending on the length of the initial vector and each time you write a corresponding zeros as a string(e.g.:"0000").
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multidimensional Arrays 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!