在Matlab中将单元格数组作为函数参数传递

问题描述:

我有100个256x256图像的像元阵列.如何将它们作为函数参数传递?我尝试过

I have a cell array of 100 256x256 images. How can I pass them as function argument? I tried

function[d] = thresh(c{k})

但是使用调用时会给出错误

but it gives an error when called using

x = thresh(c);

我也尝试过

function [ ] = thresh(c)

也不起作用.

您的函数语法对我来说似乎是错误的.

Your function syntax looks wrong to me.

例如,如果要对单元格数组的每个图像应用另一个函数,则应执行类似的操作.

If, for example you want apply another function to each image of the cell array you should do something like that.

num_images = 100;

function [output] = thresh(c)

for i = 1:num_images
modifiedImage = modifyImage(c{k})
end    

让我们知道您要如何处理图像,如果还有图像,这是您的错误.

Let us know what you want to do with the image and which is your error if you still have one.