Question

LECN O72 SPIS 52pd-Adobe Acobat Pro DC Id Vew Wwindow Halp ELECZ30 072 3P1 ame lools O & T O Quiz 2, Sec 52, 24/04/2019 Write
0 0
Add a comment Improve this question Transcribed image text
Answer #1

function [zeroes,indexes,sizes]= findzeros(x,n)
r=0;
for k=1:n
if (x(k)== 0 )
r=r+1;
zeroes(r)=0;
indexes(r)=k;
end
end
sizes=length(indexes);
end

--------------------

[x,y,z]=findzeros([1 88 0 0 7 0 8 0],8);
disp(['zeros array : ' num2str(x)]);
disp(['indes array : ' num2str(y)]);
disp(['size : ' num2str(z)]);

--------------------

>> m3
zeros array : 0 0 0 0
indes array : 3 4 6 8
size : 4

Add a comment
Know the answer?
Add Answer to:
LECN O72 SPIS 52pd-Adobe Acobat Pro DC Id Vew Wwindow Halp ELECZ30 072 3P1 ame lools...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • LEC230,0z2.SP19.51pot-AdobeAoobat Pro DC F Viw Window Help Home tools ELEC230 CZ22, SP1 Sign tn Quiz 2,...

    LEC230,0z2.SP19.51pot-AdobeAoobat Pro DC F Viw Window Help Home tools ELEC230 CZ22, SP1 Sign tn Quiz 2, Sec 51, 28/04/2019 write a program that reads all values from a text file "data.txt" and stores them in 1D array values The input process from the file should be terminated when a negative value is detected. (An example of such a file is shown below). Also, the program should copy from values[1 any value which has even sum of digits and its Index...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT