Troubleshooting a 'for' loop code - help!
2 views (last 30 days)
Show older comments
fiona rozario
on 11 Feb 2017
Edited: Walter Roberson
on 11 Feb 2017
This is my code -
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160593/image.png)
The code is not running through the second for loop i.e. for 'l'. As a result elements of only the first row of all columns are getting updated. Output is:
encrypt =
44 140 108
0 0 0
0 0 0
What did I miss in the code?
0 Comments
Accepted Answer
Walter Roberson
on 11 Feb 2017
You have
encrypt(i,j)=temp
but your i is always 1, so you never write outside of the first row.
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!