passing cell array to function

3 ビュー (過去 30 日間)
dmulky
dmulky 2013 年 12 月 1 日
編集済み: Wayne King 2013 年 12 月 1 日
Hi,
I am trying to pass a cell array of images to a function which converts each image to grayscale and single precision and then does some manipulation on them:
function [a, b, c]= createGMM(cell_array)
for k=1:length(cell_array)
%convert to grayscale
new_image=rgb2gray(cell_array{k});
%convert to single
single_image=im2single(new_image);
..........
..........
When I run this code- [m, c, p]= createGMM(images) with the 'images' cell array (which is in my workspace) I get the error
Undefined function 'createGMM' for input arguments of type 'cell'.
Please let me know what I am doing wrong. Thanks!

採用された回答

Wayne King
Wayne King 2013 年 12 月 1 日
編集済み: Wayne King 2013 年 12 月 1 日
Have you saved the function in a folder that is on the MATLAB path?
MATLAB needs to know how to find the function.
Use
>>addpath 'c:\path_to_folder'
or
>>pathtool
to add the folder where you have save createGMM to the path.

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 12 月 1 日
createGMM.m is not on your MATLAB path, or your existing createGMM.m has an error in it that is preventing it from being parsed, so MATLAB is ignoring it.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by