MATLAB Answers

How to use 2 forloop in matlab?

조회 수: 1(최근 30일)
Muhammad Andi Yusran
Muhammad Andi Yusran 2020년 3월 17일
댓글: Muhammad Andi Yusran 2020년 3월 17일
I have a Mat-file. My Mat-file have 204 length. How can i just get from length 1 to 51 from my Mat-file? How can i use another forloop in my code to get i = 1 till i = 51? This is my code.
a = 0;
m = matfile('elm_output.mat');
output = m.output;
for i = 1:length(output)
if output(i) == 1
a = a+1;
end
end

채택된 답변

Bhaskar R
Bhaskar R 2020년 3월 17일
required = output(1:51);
  댓글 수: 2
Muhammad Andi Yusran
Muhammad Andi Yusran 2020년 3월 17일
Yes Mr. Bhaskar, but i can figure it out now. Thanks for your attention sir. Thank you so much.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by