Pati
Pati

Reputation: 11

MATLAB genlouvain function, group_handler with missing 'char' input?

I'm trying to use the genlouvain function for finding community structure in a matrix. I'm getting an error saying Undefined function 'group_handler' for input arguments of type 'char'.

Error in genlouvain (line 272) group_handler('assign',y); Not sure what the problem is. I don't have any char in my workspace and the matrix I'm giving the function is symmetrical...I'm wondering if I need to define a char variable somewhere to give it another input? Has anyone else used the genlouvain function and had issues with char input arguments?

Upvotes: 1

Views: 590

Answers (2)

samplesize1
samplesize1

Reputation: 111

I'm offering a second answer to this question, because I got the same error although I am running 64 bit MATLAB:

The genlouvain.m script has several dependencies, saved as C code and not as .m scripts (eg group_handler) which you should have also downloaded; be sure that they are all in the same folder from which you are running the genlouvain script.

Upvotes: 1

rayryeng
rayryeng

Reputation: 104535

genlouvain is not a native MATLAB function, and I had to Google for it. I found it here: http://netwiki.amath.unc.edu/GenLouvain/GenLouvain.

If you look at the README file, it says that the code is written in MEX and was pre-compiled for 64-bit Mac OS, Windows and Linux.

Your OS is probably none of these, and the README says that you need to compile the MEX code if your operating system is not 64-bit, before you run the code. Specifically, there are no pre-compiled functions for your operating system, and group_handler is a function that results after you compile the code (check the private folder in the .zip file). Because there is no group_handler function specific for your operating system, MATLAB complains because it can't find the file.

To generate the right compiled functions for your operating system so you can run this code, go into the MEX_SRC directory and run the compile_mex.m script.


However, you need to make sure mex is installed. As such, type in mex -setup in your command prompt before you run compile_mex.m and make sure you choose the right compiler that is for your operating system. In Windows, this will most likely be the Visual C++ compiler, Mac OS will have their own flavour of gcc (clang actually), and Linux will most likely be gcc itself.

Once you do this, your function should now work.

FWIW, if you actually read the README file, or went onto the website and looked at the FAQ, you could have gotten the answers from there.

Upvotes: 1

Related Questions