作者:minggute_111 | 来源:互联网 | 2023-09-17 14:53
I have an array that starts with a few dozen 0's, proceeds with a few numbers, and than ends with a few more zeros. I want to make a new array with just the numbers, not the zeros. it looks something like this
我有一个数组,从几十个0开始,继续几个数字,然后结束几个零。我想用数字而不是零来创建一个新数组。它看起来像这样
0 0 0 0 0 0 0 0 0 0 245 35635 3563 6346 3465 34 235 46 356 36 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 245 35635 3563 6346 3465 34 235 46 356 36 0 0 0 0 0 0 0 0 0 0 0
I want to make an array that start like this in matlab
我想在matlab中创建一个像这样开始的数组
245 35635 3563 6346 3465 34 235 46 356 36
245 35635 3563 6346 3465 34 235 46 356 36
Any ideas. I tried to use if statements within a loop, but I can only get the zeros at the end to go away
有任何想法吗。我试图在循环中使用if语句,但我只能在最后得到零消失
5 个解决方案