how to the save value of variable obtained in iterative process when we input the value of the variable from txt file or excel file?

1 ビュー (過去 30 日間)
function sum_b = fcn(c)
for ii=1:length(c)
This works perfectly fine when i specify c=1:10,but when i am taking the value from outside,it's not giving me a perfect output.Please help.

回答 (1 件)

Jyotish Robin
Jyotish Robin 2017 年 3 月 14 日
Hi Smruti!
This is possibly because you may not be properly loading the data from the text or excel file to MATLAB.
You can read through the below links to know how to read these files into MATLAB workspace:
Once you load the variable to MATLAB workspace, make sure that the variable is of proper numeric data type.
Note :The input argument to the function 'length' has to be Input array, specified as a numeric array, character array, logical array, structure, cell array, categorical array, datetime array, duration array, or calendarDuration array.
Hope the above suggestions are helpful.


Community Treasure Hunt

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

Start Hunting!

Translated by