小编Rom*_* B.的帖子

Bash - 重命名文件,其中包含"

好吧,我有一个功能,将有作为参数字符串,它会输出一个新的字符串具有任何的空间,',"

function rename_file() {

local string_to_change=$1
local length=${#string_to_change}
local i=0   
local new_string=" "
local charac

for i in $(seq $length); do
    i=$((i-1))
    charac="${string_to_change:i:1}"

    if [ "$charac" != " " ] && [ "$charac" != "'" ] && [ "$charac" != """ ];  then #Here if the char is not" ", " ' ", or " " ", we will add this char to our current new_string and else, we …
Run Code Online (Sandbox Code Playgroud)

linux bash shell file

3
推荐指数
1
解决办法
55
查看次数

将一组索引索引到矩阵

我从图像中检索了所有非白色像素:

[ii, jj] = find(BlackOnWhite < 255)
Run Code Online (Sandbox Code Playgroud)

然后我尝试将这些像素坐标索引到矩阵:

image(ii, jj) = 0
Run Code Online (Sandbox Code Playgroud)

但是零没有出现在预期的位置.如何将零只放在由iijj([ii(1), jj(1)], [ii(2), jj(2)]等等)对指定的位置?

matlab mask matrix indices matrix-indexing

0
推荐指数
1
解决办法
73
查看次数

标签 统计

bash ×1

file ×1

indices ×1

linux ×1

mask ×1

matlab ×1

matrix ×1

matrix-indexing ×1

shell ×1