问题标签 [zero-pad]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
matlab - 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 thay generates a huge error in time space.
As zéro padding in the fourier space seems to be a common (and fast) interpolation method, I assume that there is something I am missing:
Here is the matlab code:
I am not able to post images of the result because of my reputation, but, graph are easy to generates, through matlab. I would really appreciate a comment on either this code or zero padding fft for interpolation in general.
Thank you in advance
mysql - sql中的零填充字母数字字符串
如果它是一位数字,我想在字母数字字符串中添加零。
我得到的是这样的:
CV-1-1A
CV-1-32
CV-12-24
CV-1-2
CV-1-2A
我想将其更改为:
CV-01-01A
CV-01-32
CV-12-24
CV-01-02
CV-01-02A
c - 是否可以用空格而不是 C 中的零填充前导零?
想知道我是否做了类似的事情
我可以打印吗
代替
我知道奇怪的要求,但这是我需要的。不知道如何开始。
r - 在没有前导零的情况下格式化 R 中的日期
有没有办法format
在日期对象上使用该函数,特别是 class POSIXlt
、POSIXct
或的对象Date
,其格式%Y, %m, %d
可以从这三个字段中的每个字段中去除前导零?
例如,我想format(as.Date("1998-09-02"), "%Y, %m, %d")
返回1998, 9, 2
而不是1998, 09, 02
。
matlab - 零填充、位丢弃以及添加开始位和停止位 - MATLAB
更新:我使用 zeros() 而不是 padarray 并解决了问题。
我有一个存储在列向量 bs 中的位序列。我想生成一个长度为 1280 个数据位加上 1 个起始位 (1) 和 1 个停止位 (0) 的帧。
因此,如果 bs 的长度小于 1280,我必须对其进行零填充,直到它等于 1280。我尝试了 bs = padarray(bs, 1280-length(bs)); 但它不起作用。
如果 bs 的长度大于 1280,那么我只需要获取它的前 1280 个元素,其余的我将丢弃。我假设以下行将完成这项工作: bs = bs(1:1280); 那是对的吗?
如果 bs 的长度等于 1280,则可以。
接下来,我必须在开头添加一个起始位 (1),在末尾添加一个停止位 (0),以形成长度为 1 + 1280 + 1 = 1282 位的帧。我怎样才能做到这一点?
谢谢。
c++ - 如何使用 boost::format 对变量中包含小数位数的数字进行零填充?
我想对一个数字进行零填充,使其具有 5 位数字并将其作为字符串获取。这可以通过以下方式完成:
但是,我不想硬编码位数(即“%05u”中的 5)。
如何使用 boost::format,但通过变量指定位数?
(即输入位数,unsigned int numberOfDigits = 5
然后将 numberOfDigits 与 boost::format 一起使用)
matlab - Zeropad a matrix in matlab
I'm having a signal y of 52989 x 2 values. What I want to do is zero pad it until I get like signal y_mp3 66379 x 2. Here a sample of my code:
I constantly receive the error: dimensions of matrices being concatenated are not consistent. I tried to switch the 1 and P or the 2 arguments but stil no good. Can someone clarify my error?
EDIT: I tried following suggestion but still the same:
Thanks in advance everyone!
matlab - 零填充MATLAB中的向量
我有一个包含 5 个数字的向量,我想用零填充它。我该怎么做?
我希望零填充向量是这样的:
另外,对于另一种情况,我想将 1、3、4 分配给矩阵W
,如下所示,其他全部为零。长度W
为7 W = [0 1 0 0 3 0 4]
..
matlab - Matlab字符串中的可变数量的左零
我想做这个问题的确切内容,但不必给出固定数量的左侧零,而是能够给出该数字总共必须具有的固定位数。
例如,如果我有 number32
并且长度为4
,则结果应该是:
但是如果相反我有 number 122
,那么只0
应该填充一个:
关于如何在 Matlab 上有效地实现这一点的任何想法?sprintf
?
java - 用尾随零填充 DateTimeFormatter
我正在创建一个应用程序,用户在日历中选择一个日期和时间,然后应该在文本字段中显示为 26 位数字,用尾随零填充日期。
所以日期应该以如下格式显示:
yyyyMMddHHmmssSSS000000000
所以在毫秒(SSS)之后,我想用 9 个零填充字符串。问题是,如果不在模式字母和零常数之间添加空格,这似乎是不可能的。
有趣的是,如果我这样做,DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS000000000")
我会得到一个 DateTimeParseException
,但字符串实际上是在文本字段中根据需要格式化的。问题是,当DateTimeFormatter
使用 try-catch 块进行实例化时,Eclipse 会告诉我 Unreachable catch block for DateTimeParseException. This exception is never thrown from the try statement body
,因为异常是在我的文本字段的某个依赖类中引发的。此外,捕获每次执行代码时都会抛出的错误似乎是一种不好的做法。
DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS 000000000")
编译。但我真的需要它是一个没有任何空格的字符串。
这可能吗?我目前正在使用java.time.format.DateTimeFormatter
,但如果有一些类在那里扩展它,我想使用它也可以。虽然我更愿意避免添加额外的依赖项。