Matrix of unknown length in MATLAB?

Answer

if the number of columns is fixed you can always add rows to your matrix (inside the loop)

e.g.

while(....).....
   new_row =[x y];%new row with values x & y
   mat =[mat ; new_row];

of course if you know the number of iterations before the while loop it's more efficient to pre-allocate the matrix

All matlab Questions

Ask your interview questions on matlab

Write Your comment or Questions if you want the answers on matlab from matlab Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---