Martix is getting updated with the value of e,Without adding a new column, Please help me.

2 次查看(过去 30 天)
persistent eWithDeltaL;
eWithDeltaL = [];
eWithDeltaL(end+1) = e;

采纳的回答

Walter Roberson
Walter Roberson 2016-6-2
You are overwriting eWithDeltaL with [] every time. You should have the assignment of [] to the variable only when you know that you want to reset the variable.
  2 个评论
Walter Roberson
Walter Roberson 2016-6-2
When you declare a variable as persistent, it is automatically assigned [] if it does not already exist. You do not need to initialize it to [] unless you want to reset it.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by