Mazhar Iqbal Rana
Mazhar Iqbal Rana

Reputation: 75

Synonyms Matlab function

Ok now I have built this function ins MATLAB but it is not working..Maybe somewhere error exists

Do Guide please...

Code Below

PFA

function takesynonyms(words)
%words = {'good'};%, 'bad', 'apple'};

Doc = actxserver('Word.Application');
X = cellfun(@(word) invoke(Doc,'SynonymInfo',word), words, 'UniformOutput', false);
Synonyms = cellfun(@(X) get(X,'MeaningList'), X, 'UniformOutput', false);

On main command, I must write takesynonyms(mywords) and it should return me synonyms

normally it works fine but how in function to use it?

Thanks

Upvotes: 1

Views: 219

Answers (1)

buzjwa
buzjwa

Reputation: 2652

If you want your final results returned from the function, define them as output in the function header:

function Synonyms = takesynonyms(words)

This way you can call the function and retrieve its output into some variable:

goodSynonyms = takesynonyms('good');

Read more about defining functions in the documentation.

Upvotes: 0

Related Questions