Info

This question is closed. Reopen it to edit or answer.

How do you have an unlimited number of variables in your matrix when doing the secant method?

1 view (last 30 days)
I'm using the secant method to calculate a variable on Matlab and the matrix I'm importing has 43 columns. I've created a zero vector to output my values in using the code: 'tm=zeros(1,43); and then I've told the code to proceed for the 43 corresponding values that are in my matrix using the code: 'for i=(1:43)'. However, I want to make it so that I have an undefined number of columns, rather than 43, just incase I added more data to the matrix I imported.
Thanks.

Answers (1)

John D'Errico
John D'Errico on 10 Mar 2015
So why not check the size of the matrix, then use a loop of length based on that size? Any of these tools will give you what you want.
help numel
help size
help length

Community Treasure Hunt

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

Start Hunting!