How to loop over a customized function?
Show older comments
Hello everyone,
I wrote a function and I would like to use it on many data at once, so I tried to use the function inside a for loop.
But I got this error
In an assignment A(:) = B, the number of elements in A and B must be the same.
Kindly find the function and my code attached with sample files.
I appreciate your help.
Note: put all the files in the same folder and run the file "semimanual_matching.m".
Basically, I need to run this line
T(n) = V2(dinfo(n).name, V(n));
for several text files, For instance, the function "V2" will run for the first text file "dinfo(1).name" and will take the first value of "V(1)" and put the result in the first cell of "T" ---> T(1).
Currently the error is
Subscripted assignment dimension mismatch.
Error in semimanual_matching (line 12)
T(n) = V2(dinfo(n).name, V(n));
4 Comments
Jim Riggs
on 21 Dec 2019
I cannot find a line of code with "A(:) = B"
Mohamed Nedal
on 21 Dec 2019
per isakson
on 21 Dec 2019
Edited: per isakson
on 21 Dec 2019
I miss an instruction on how to use your files. And I miss the file matlab.mat, which is loaded in the first line of the second section of semimanual_matching.
What release of Matlab are you running?
Mohamed Nedal
on 21 Dec 2019
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Identification 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!