creating matrix by iteration 2
显示 更早的评论
Hi Everyone how are You? Can U help with this PLEASE: n=4 for i=1:n s=i if s == 3 for k =1:2 A(i,1) =s A(s+1,1)=s end else A(i,1) =s end end I want like this result: A=[1;2;3;3;4]. which if s == 3 it should be repeated 2 times in the matrix.
5 个评论
Azzi Abdelmalek
2014-8-9
Format correctly your code
Akmyrat
2014-8-9
Azzi Abdelmalek
2014-8-9
Is this a homework?
Akmyrat
2014-8-9
Jan
2014-8-10
@Akmyrat: This is a final project? And you solve it by asking a public forum? Impressing.
采纳的回答
更多回答(1 个)
Roger Stafford
2014-8-9
A = floor((15:8:47)'/10);
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!