JimHokanson / adinstruments_sdk_matlab

Implementation of AD Instruments SDK in Matlab - i.e. reads LabChart files
MIT License
26 stars 8 forks source link

Problem to add path in Matlab on Linux #8

Closed dannyqchen closed 8 years ago

dannyqchen commented 8 years ago

Hello,

This is a cool toolbox. I am trying to use it in Matlab on Linux, but it seems I cannot add '.../adinstruments_sdk_matlab/+adi/' into pathes. Should I remove '+'?

Many thanks!

JimHokanson commented 8 years ago

Only add the adinstruments_sdk_matlab folder to the path. The '+' indicates a Matlab package, and you only add the parent folder of the package to the path, not the package itself.

dannyqchen commented 8 years ago

Many thanks, Jim!!

I added the adinstruments_sdk_matlab, but I have problem to read my data. The error is:

Undefined function ‘sdk_mex’ for input arguments of type ‘int16’.

Error in adi/sdk/openFile (line 156)

Is that because of my data is int16?

Thanks again!

From: Jim Hokanson [mailto:notifications@github.com] Sent: Tuesday, July 26, 2016 7:48 AM To: JimHokanson/adinstruments_sdk_matlab Cc: dannyqchen; Author Subject: Re: [JimHokanson/adinstruments_sdk_matlab] Problem to add path in Matlab on Linux (#8)

Only add the adinstruments_sdk_matlab folder to the path. The '+' indicates a Matlab package, and you only add the parent folder of the package to the path, not the package itself.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JimHokanson/adinstruments_sdk_matlab/issues/8#issuecomment-235244841 , or mute the thread https://github.com/notifications/unsubscribe-auth/AM7cVJCm9xhDwIR1SdO6NM_FAGAt6c-yks5qZfPzgaJpZM4JUub2 . https://github.com/notifications/beacon/AM7cVOmABObcZoAPzc9DXV2axHsjxEJqks5qZfPzgaJpZM4JUub2.gif

JimHokanson commented 8 years ago

I would need to know what your code looks like to help out further

dannyqchen commented 8 years ago

Hi Jim,

My code is quite simple. Attached please find my example data. Please help me to check if I use your functions correctly. Many thanks!!


addpath('/home/danny.chen/Programs/Matlab/LabChart/adinstruments_sdk_matlab-master/')

f_adi = {'Choice_1.adicht'};

f = adi.readFile(f_adi{1});

% Undefined function 'sdk_mex' for input arguments of type 'int16'.

%

% Error in adi/sdk/openFile (line 156)

% [result_code,pointer_value] = sdk_mex(0,h__toWChar(file_path));

%

% Error in adi/readFile (line 68)

% file_h = sdk.openFile(file_path);

adi.convert(f_adi,'format','mat');

%

% Undefined function 'sdk_mex' for input arguments of type 'int16'.

%

% Error in adi/sdk/openFile (line 156)

% [result_code,pointer_value] = sdk_mex(0,h__toWChar(file_path));

%

% Error in adi/readFile (line 68)

% file_h = sdk.openFile(file_path);

%

% Error in adi/convert (line 101)

% file_obj = adi.readFile(cur_file_path);

%


From: Jim Hokanson [mailto:notifications@github.com] Sent: Tuesday, July 26, 2016 7:20 PM To: JimHokanson/adinstruments_sdk_matlab Cc: dannyqchen; Author Subject: Re: [JimHokanson/adinstruments_sdk_matlab] Problem to add path in Matlab on Linux (#8)

I would need to know what your code looks like to help out further

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JimHokanson/adinstruments_sdk_matlab/issues/8#issuecomment-235435589 , or mute the thread https://github.com/notifications/unsubscribe-auth/AM7cVM3B5gltb_HFIO_GpARiTFu2DMz0ks5qZpYGgaJpZM4JUub2 . https://github.com/notifications/beacon/AM7cVMtyp6GVQmZ4KwcJJD5AanUOSaHlks5qZpYGgaJpZM4JUub2.gif

JimHokanson commented 8 years ago

Doh, I just reread your original post. My apologies, currently the underlying code from ADInstruments relies on Windows calls. The error you are getting is that I haven't compiled a wrapper for Linux, since I literally can't.

dannyqchen commented 8 years ago

Oh, I see. This makes sense. I’ll find Windows Matlab first. Many thanks!!

From: Jim Hokanson [mailto:notifications@github.com] Sent: Tuesday, July 26, 2016 10:11 PM To: JimHokanson/adinstruments_sdk_matlab Cc: dannyqchen; Author Subject: Re: [JimHokanson/adinstruments_sdk_matlab] Problem to add path in Matlab on Linux (#8)

Doh, I just reread your original post. My apologies, currently the underlying code from ADInstruments relies on Windows calls. The error you are getting is that I haven't compiled a wrapper for Linux, since I literally can't.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JimHokanson/adinstruments_sdk_matlab/issues/8#issuecomment-235461517 , or mute the thread https://github.com/notifications/unsubscribe-auth/AM7cVMZ0FaYNca2Sn1wJNaPmjqXK8lcJks5qZr4xgaJpZM4JUub2 . https://github.com/notifications/beacon/AM7cVB6lNBUcKxSUhnCTZ_goyRSW-AY8ks5qZr4xgaJpZM4JUub2.gif

dannyqchen commented 8 years ago

Dear Jim,

I ran your script in Windows Matlab. There is no problem to read the .adicht data now, but I got some errors to convert it to .mat file. Can you help me more on this?

Many thanks!

From: Jim Hokanson [mailto:notifications@github.com] Sent: Tuesday, July 26, 2016 10:11 PM To: JimHokanson/adinstruments_sdk_matlab Cc: dannyqchen; Author Subject: Re: [JimHokanson/adinstruments_sdk_matlab] Problem to add path in Matlab on Linux (#8)

Doh, I just reread your original post. My apologies, currently the underlying code from ADInstruments relies on Windows calls. The error you are getting is that I haven't compiled a wrapper for Linux, since I literally can't.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JimHokanson/adinstruments_sdk_matlab/issues/8#issuecomment-235461517 , or mute the thread https://github.com/notifications/unsubscribe-auth/AM7cVMZ0FaYNca2Sn1wJNaPmjqXK8lcJks5qZr4xgaJpZM4JUub2 . https://github.com/notifications/beacon/AM7cVB6lNBUcKxSUhnCTZ_goyRSW-AY8ks5qZr4xgaJpZM4JUub2.gif

JimHokanson commented 8 years ago

You can always post an issue. You don't need to ask for permission. Please start a different issue and post specifics as to what is not working. I haven't used the conversion code in a while so it is possible it has a bug or two.

dannyqchen commented 8 years ago

Dear Jim,

I ran your script in Windows Matlab. There is no problem to read the .adicht data now, but I got some errors to convert it to .mat file. Can you help me more on this? Many thanks!

f_adicht = {'C:\A_Temp\Choice_1.adicht'}; f = adi.readFile(f_adicht{1}); adi.convert(f_adicht, 'save_path', 'C:\A_Temp\Choice_1.mat') Undefined function 'exportToMatFile' for input arguments of type 'matlab.io.MatFile'.

Error in adi/record/exportToMatFile (line 104) exportToMatFile([objs.comments],m,conversion_options)

Error in adi/file/exportToMatFile (line 246) obj.records.exportToMatFile(m,conversion_options);

Error in adi/convert (line 112) save_path = file_obj.exportToMatFile(save_path,in.conversion_options);

JimHokanson commented 8 years ago

There was a bug when no comments were present in any record. Please update your code and try again.

dannyqchen commented 8 years ago

I tried to add comment, but I cannot edit file:

f = adi.editFile(f_adicht); Warning: The following error was caught while executing 'adi.data_writer_handle' class destructor: ADINSTRUMENTS:SDK:sdk:closeWriter Unspecified error. In adi/editFile (line 8) Error using adi/file_writer (line 155) Not yet implemented

Error in adi/editFile (line 16) file_writer = adi.file_writer(file_path, file_h, data_writer_h, false);

JimHokanson commented 8 years ago

The writing code doesn't work yet. You just need to update the code and then having no comments should be fine.

On Sat, Jul 30, 2016 at 12:39 PM, dannyqchen notifications@github.com wrote:

I tried to add comment, but I cannot edit file:

f = adi.editFile(f_adicht); Warning: The following error was caught while executing 'adi.data_writer_handle' class destructor: ADINSTRUMENTS:SDK:sdk:closeWriter Unspecified error. In adi/editFile (line 8) Error using adi/file_writer (line 155) Not yet implemented

Error in adi/editFile (line 16) file_writer = adi.file_writer(file_path, file_h, data_writer_h, false);

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/JimHokanson/adinstruments_sdk_matlab/issues/8#issuecomment-236375263, or mute the thread https://github.com/notifications/unsubscribe-auth/ABhPx1o7xqU36N7RlFl4KYXkMl50iROgks5qa35CgaJpZM4JUub2 .

dannyqchen commented 8 years ago

I am a little confused. I didn't add any comments in the data. Do you mean I need to empty some fields in f?

dannyqchen commented 8 years ago

I have just two lines of code here:

f_adicht = 'C:\A_Temp\Choice_1.adicht'; adi.convert(f_adicht, 'save_path', 'C:\A_Temp\Choice_1.mat')

JimHokanson commented 8 years ago

I have modified my code and posted a new version on Github. You need to download that code, which contains a bug fix. Then your code should work.

On Sat, Jul 30, 2016 at 2:03 PM, dannyqchen notifications@github.com wrote:

I have just two lines of code here:

f_adicht = 'C:\A_Temp\Choice_1.adicht'; adi.convert(f_adicht, 'save_path', 'C:\A_Temp\Choice_1.mat')

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/JimHokanson/adinstruments_sdk_matlab/issues/8#issuecomment-236380099, or mute the thread https://github.com/notifications/unsubscribe-auth/ABhPx6NIQ_RbMea4aFbvqoB1HHdzk5WFks5qa5IKgaJpZM4JUub2 .

dannyqchen commented 8 years ago

It works very well now. Thank you very much!