Quantcast

Trouble importing core object into Matlab

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Trouble importing core object into Matlab

cfoy3
Hello my name is Christopher Foy and I  am trying to follow the steps listed here:

to get the micromanager core object loaded into windows. I have followed the directions but it still seems to not load in correctly when I try to load in the demo. Here is what I have done:

I have micromaneger 1.4.17 and I am using matlab 2017a. I have added a new path using

 edit([prefdir '/javaclasspath.txt']);

where I have used this code found here and shown below. 

%% nested directory listing ala gnovice from stackoverflow
% inputs and outputs are self-explanatory
function fileList = getAllFiles(dirName)

dirData = dir(dirName); %# Get the data for the current directory
dirIndex = [dirData.isdir]; %# Find the index for directories
fileList = {dirData(~dirIndex).name}'; %'# Get a list of the files
if ~isempty(fileList)
    fileList = cellfun(@(x) fullfile(dirName,x),fileList,'UniformOutput',false);
end
subDirs = {dirData(dirIndex).name}; %# Get a list of the subdirectories
validIndex = ~ismember(subDirs,{'.','..'}); %# Find index of subdirectories
%# that are not '.' or '..'
for iDir = find(validIndex) %# Loop over valid subdirectories
    nextDir = fullfile(dirName,subDirs{iDir}); %# Get the subdirectory path
    fileList = vertcat(fileList, getAllFiles(nextDir)); %# Recursively call getAllFiles
end

To setup the new java class path. I have confirmed it works in matlab when I enter

javaclasspath
Into the command line I correctly see all the .jar files. I next edited the edited
librarypath.txtfile using worpad run as an Administrator and added 

C:\Program Files\Micro-Manager-1.4

when I run

 edit librarypath.txt 

in the command line of matlab I correctly see the path for the micromanager dll files. I added 
this path to the system path as well. I restart matlab and when I try to run
addpath('C:\Program Files\Micro-Manager-1.4')
import mmcorej.*;
>> mmc = CMMCore;
Matlab doesn't fine CMMCore. Any help would be appreciated. Thanks. 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trouble importing core object into Matlab

Kyle Douglass

Hi Christopher,

I don't see any obvious mistake or problem in your explanation of how you tried to setup MATLAB. Here are a few suggestions:


1) It looks like you followed the MM documentation at

https://micro-manager.org/wiki/Matlab_Configuration . In my experience, the only section of that documentation which I have found relevant for the most recent MM versions is at the very bottom of the page entitled "A function to help MATLAB recognize Micro-Manager." Try ignoring the rest and following the directions only this section.


2) Related to number 1: I would try the full version of Kyle Karhoh's script to locate the MM libraries; the getAllFiles() function is only intended to be used from another function within that script. I can confirm that the full script at the bottom of the documentation page has always worked for me in MM 1.4/2.0, MATLABs 2014-2016, and Windows and Linux.


3) Perhaps you could try sending a link containing your full javaclasspath so that others can verify its output.


4) Try the startup script that Mark wrote. I can't think of the name at the moment, but I believe it's a .m file in MM's parent directory. IIRC it is based on Kyle's original script but is more feature-complete.


Cheers,

Kyle


Dr. Kyle M. Douglass
Post-doctoral Researcher
EPFL - The Laboratory of Experimental Biophysics
http://leb.epfl.ch/
http://kmdouglass.github.io

From: Christopher Foy <[hidden email]>
Sent: Wednesday, April 26, 2017 4:42 PM
To: Micro-Manager General
Subject: [micro-manager-general] Trouble importing core object into Matlab
 
Hello my name is Christopher Foy and I  am trying to follow the steps listed here:

to get the micromanager core object loaded into windows. I have followed the directions but it still seems to not load in correctly when I try to load in the demo. Here is what I have done:

I have micromaneger 1.4.17 and I am using matlab 2017a. I have added a new path using

 edit([prefdir '/javaclasspath.txt']);

where I have used this code found here and shown below. 

%% nested directory listing ala gnovice from stackoverflow
% inputs and outputs are self-explanatory
function fileList = getAllFiles(dirName)

dirData = dir(dirName); %# Get the data for the current directory
dirIndex = [dirData.isdir]; %# Find the index for directories
fileList = {dirData(~dirIndex).name}'; %'# Get a list of the files
if ~isempty(fileList)
    fileList = cellfun(@(x) fullfile(dirName,x),fileList,'UniformOutput',false);
end
subDirs = {dirData(dirIndex).name}; %# Get a list of the subdirectories
validIndex = ~ismember(subDirs,{'.','..'}); %# Find index of subdirectories
%# that are not '.' or '..'
for iDir = find(validIndex) %# Loop over valid subdirectories
    nextDir = fullfile(dirName,subDirs{iDir}); %# Get the subdirectory path
    fileList = vertcat(fileList, getAllFiles(nextDir)); %# Recursively call getAllFiles
end

To setup the new java class path. I have confirmed it works in matlab when I enter

javaclasspath
Into the command line I correctly see all the .jar files. I next edited the edited
librarypath.txtfile using worpad run as an Administrator and added 

C:\Program Files\Micro-Manager-1.4

when I run

 edit librarypath.txt 

in the command line of matlab I correctly see the path for the micromanager dll files. I added 
this path to the system path as well. I restart matlab and when I try to run
addpath('C:\Program Files\Micro-Manager-1.4')
import mmcorej.*;
>> mmc = CMMCore;
Matlab doesn't fine CMMCore. Any help would be appreciated. Thanks. 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Loading...