Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How do I index through logical vectors properly?

1 回表示 (過去 30 日間)
Bianca Elena Ivanof
Bianca Elena Ivanof 2016 年 4 月 4 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hiya,
I have this piece of code (see image below).
1. when I run it, it does everything except the most important part, i.e the if statement (see image below).
2. I'm also struggling to attach the newly-created 'correction_b' column to the main all_baseline_data array --> all_baseline_data(:,25) = judgment_error_b(correction_b);
I have a hunch the problem is in the logical vs scalar dimensions, but I'm unsure.
Thank you in advance

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 4 月 4 日
inside your "for i" loop, every place you have judgement_error_b, you need to index it at i, such as
if judgement_error_b(i) < -1280
  2 件のコメント
Bianca Elena Ivanof
Bianca Elena Ivanof 2016 年 4 月 4 日
thank you very much
I understand why and I've done it but it doesn't seem to solve my problem, especially point 2 (i.e. after the if statement to attach the correction_b column to the main array
Walter Roberson
Walter Roberson 2016 年 4 月 5 日
Please show your new code.

Community Treasure Hunt

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

Start Hunting!

Translated by