continious Zero Matrix filling
1 次查看(过去 30 天)
显示 更早的评论
I have a GUI in which ill enter values and save those variables in one Matrix. So every time i enter variables and push the button i want the matrix to get populated continiously.
Here is my work so far:
sc = [d, l, hs1, hs2, bs1, bs2, phi1, phi2]; % vecotr in which the variables are written in
mat=zeros(100,8); % Zero Matrix with 8 columns for the 8 variables and 100 rows max.
mat(1,1:length(sc))=sc % here i want to write the vektor into the zero matrix
% save in variable setappdata(0,'sc',sc)
i dont know how i can write the code for adding the variables into the zero matrix without erasing the last ones. so every time i push the button in the gui i want the vector sc to be saved in the zero matrix .
thanks
0 个评论
采纳的回答
Nirmal
2012-6-6
In that case you need to setup a counter lets say cnt
cnt=0%initialization at the very beginning
Now you need to use the counter as the index. Where you want to use a loop or not is totally upto you and the application you are building.
sc = [d, l, hs1, hs2, bs1, bs2, phi1, phi2]; % vecotr in which the variables are written in
mat(cnt,1:length(sc))=sc % here i want to write the vektor into the zero matrix
cnt=cnt+1;%increment the counter
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!