在Matlab中将单元格数组作为函数参数传递 [英] Pass cell array as function argument in matlab

查看:1345
本文介绍了在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.

这篇关于在Matlab中将单元格数组作为函数参数传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆