Call function and save results

3 ビュー (過去 30 日間)
SBakc
SBakc 2019 年 5 月 8 日
回答済み: James Tursa 2019 年 5 月 8 日
Hi. I have a while loop that iterates through all images in a datastore, and calls a function passing each image. The function returns three values, and I want to save them so I can view all values that are returned. There are 50 images in the datastore.
I am trying to be able to view all the values that are returned and saved in column a, but this does not work. What am I doing wrong?
results = zeros(50,3)
iterations = 0;
while hasdata(ds)
img = read(ds);
[a, b, c] = myFunction(img);
results(iterations+1,1) = a;
results(iterations+1,2) = b;
results(iterations+1,3) = c;
iterations = iterations + 1;
end
for x = results(a)
disp(x)
end

採用された回答

James Tursa
James Tursa 2019 年 5 月 8 日
Maybe just display the results:
disp(results);
Or loop differently:
for k = 1:size(results,1)
disp(results(k,:))
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by