Discussion Overview
The discussion revolves around a MATLAB coding issue related to the use of for loops and indexing when trying to store outputs from the 'stepinfo' function. Participants explore how to correctly index and store multiple outputs in a structured way, focusing on the behavior of loop variables and function outputs.
Discussion Character
- Technical explanation
- Debate/contested
- Mathematical reasoning
Main Points Raised
- One participant expresses a desire to store outputs from 'stepinfo' in separate variables (d1 and d2) but encounters issues with overwriting data due to the way indexing is handled.
- Another participant suggests using indexing with 'd(i)' or 'di(i)' to differentiate between outputs, but the original poster indicates that this approach did not resolve the issue.
- There are questions about whether 'step' and 'stepinfo' are built-in functions, with confirmation that they are.
- One participant proposes an alternative approach using conditional statements to assign values to d1 and d2 based on the value of ki, which is later confirmed to work by the original poster.
- Concerns are raised about the structure of the for loop and the use of loop variables, with suggestions to redefine the indexing to avoid overwriting values.
- Some participants express confusion about the intended functionality of the code and the logic behind the loop structure.
Areas of Agreement / Disagreement
Participants generally do not reach a consensus on the best approach initially, as multiple suggestions are made and some methods are reported to be ineffective. However, a later reply indicates that one proposed solution successfully resolved the issue.
Contextual Notes
There are unresolved questions regarding the proper use of loop variables and indexing in MATLAB, as well as the effectiveness of different proposed solutions. The discussion reflects varying levels of familiarity with MATLAB among participants.
Who May Find This Useful
This discussion may be useful for MATLAB users facing similar issues with loop indexing and output storage, particularly in the context of control systems and data analysis.