Questions tagged [zero-pad]
41 questions
3
votes
5 answers
randint with leading zero's
I want to generate numbers from 00000 to 99999.
with
number=randint(0,99999)
I only generate values without leading zero's, of course, a 23 instead of a 00023.
Is there a trick to generate always 5 digit-values in the sense of %05d or do I really…

Birgit
- 31
- 1
- 2
3
votes
3 answers
How can I compare two images to detect duplicates and cropped duplicates?
How can I compare two images and determine if they are 100% similar, or only altered in color, or cropping?

makerofthings7
- 60,103
- 53
- 215
- 448
3
votes
0 answers
log4net RollingFileAppender: How to zero-pad the iteration number of filenames
I have a C# application that uses log4net for logging facilities. Using the RollingFileAppender and a mostly-default configuration, I get a list of files that either is or isn't convenient, depending on whether or not the program I'm using to view…

psmay
- 1,001
- 7
- 17
3
votes
3 answers
Interpolation through fourier space padding
I recently tried to implement on matlab a simple example of interpolation method using zéro padding in the fourier domain.
But I am not able to get this work properly, I always have a small frequency shift, barely not visible in fourier space, but…

Tobbey
- 469
- 1
- 4
- 18
3
votes
3 answers
Int to string conversion with leading 0s
I currently convert an integer to a string for display to the screen, but wish to maintain 4 digits - i.e 10 = "0010". What is the best way of going from an integer of 10 to a string of "0010"?
This is in C# and .NET 4.
Cheers!

CdrTomalak
- 479
- 1
- 4
- 15
2
votes
1 answer
Efficient and fast way to padarray matrix
I tried to padarray more than 1000 images. However when I time my code, this specific line take the highest amount of time to complete
I=abs(padarray(I, [2, 2], 'replicate', 'both'));
Mainly because of the line 35 of the padarray algorithm (inside…

Gregor Isack
- 1,111
- 12
- 25
2
votes
2 answers
Zero-padded FFT in Julia
How can I calculate the fft zero-padded to a specific length in Julia? Naturally, I can append zeros to my vector, but that seems awkward.
I cannot find anything about this in the docs, nor does calling methods(fft) seem to bring up any relevant…

DNF
- 11,584
- 1
- 26
- 40
1
vote
1 answer
Zero pad image before FFT in MATLAB
I have an image of size 64x64 and I should take its Fourier transform. I should pad with zeros to the right and bottom of the original image to make it 128x128, and then again take its Fourier transform. And then repeat this procedure for 256x256…

Nasim
- 161
- 1
- 3
- 12
1
vote
3 answers
Ruby String pad zero OPE ID
I'm working with OPE IDs. One file has them with two trailing zeros, eg, [998700, 1001900]. The other file has them with one or two leading zeros for a total length of six, eg, [009987, 010019]. I want to convert every OPE ID (in both files) to an…

ma11hew28
- 121,420
- 116
- 450
- 651
1
vote
2 answers
Windows batch folder loop with padding
I'm wanting to write a batch script to loop over a set of files that have a zero pad on them. I'm having problems with using set as it seems to be using the last number in my iteration as the value that should be used.
Here is what I have:
@echo…

lemming622
- 131
- 2
- 12
1
vote
1 answer
Looping zero-padded numbers in swift - Xcode
Under the SKSpriteNode class, you can do the following to animate an object
private func animate(){
var playerTextures:[SKTexture] = []
for i in 1...3 {
playerTextures.append(SKTexture(imageNamed: "image00\(i)"))
}
let playerAnimation =…

Clinton Lam
- 687
- 1
- 8
- 27
1
vote
2 answers
Pad DateTimeFormatter with traling zeros
I'm creating an application where the user picks a date and time in a calendar which then should be shown in a text field as 26 digits, padding the date with trailing zeroes.
So the date should be displayed in the following…

Jonatan Stenbacka
- 1,824
- 2
- 23
- 48
1
vote
1 answer
Zero-pad alphanumeric strings in sql
I would like to add zeros to an alphanumeric string if it's one digit.
What I've got is something like :
CV-1-1A
CV-1-32
CV-12-24
CV-1-2
CV-1-2A
and I would like to change it to:
CV-01-01A
CV-01-32
CV-12-24
CV-01-02
CV-01-02A

Artour
- 15
- 2
1
vote
2 answers
import csv, zeropad a column, then export csv in powershell
I've struggled with this all day... I'm trying to import a csv, filter out certain stores, zero pad all store ids to 5 digits, then re-export the csv with a different delimiter and remove quotes. I've got it all working except zero padding (input3…

Schrodo_Baggins
- 168
- 1
- 7
1
vote
4 answers
zero-padding and sorting - Linux Shell Scripting
I am trying to do some text file manipulation in Linux.
I have a file, called names.txt that looks like this:
A1
X12
B4
Y5
C10
Z23
B8
C3
Z6
And I need it to look like this:
A01
B04
B08
C03
C10
X12
Y05
Z06
Z23
GOAL: I need to zero-pad the single…

Sheila
- 2,438
- 7
- 28
- 37