在Matlab中查找数组中的第一个零 [英] Find first zero in array in matlab

查看:482
本文介绍了在Matlab中查找数组中的第一个零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在matlab中找到数组中的第一个零元素.我正在使用查找"功能找到零,但它没有给出真实的答案,但给出了正确答案为1.

I want to find first zero element in array in matlab. I'm using "find" function to find zero but it didn't giving true answer but it give correct answer for 1.

推荐答案

find应该可以解决问题:

> a = [1 2 3 0 5 6 0 8 9];
> find(a==0, 1, 'first')
ans =  4

让我们知道这是否不起作用(以及有关该问题的一些其他详细信息).

Let us know if this isn't working (and some additional details about the problem).

MATLAB查找

这篇关于在Matlab中查找数组中的第一个零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆