Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top