The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 Reading mat-files

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
alaudo Posted - 07/19/2005 : 11:36:14 AM
Hello!

I have many datasets stored in several mat-file (stardard file for variables in MatLab).
Is there a quick and easy way to read this data in Origin?

I tried to open variables in MatLab using Array Editor of Matlab and just copy every variable into separata dataset in Origin. It takes me for a day for one dataset ;(

Regards,
Alexander.

1   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 07/19/2005 : 1:55:30 PM
Hi Alexander,

What version of Origin do you have?
If you have 7.5 and the latest service release (SR5), then in the subfolder
\Samples\AutomationServer\MATLAB
there is a sample .m file that shows how to run Origin as a COM server from a MATLAB client.

You could thus:
1. launch Origin as server from MATLAB
2. open your mat-files using MATLAB code
3. push your MATLAB variables into Origin worksheets/matrices
4. at the end save your Origin project and close Origin
5. then re-open the project later in an Origin session to do whatever it is that you want to do in Origin with the data.

Pasted below is the m-file content of the sample file to give you a rough idea of how this will work.

You can look in the Programming help file under the topic "Calling Origin from Other Applications (Automation Server Support) for details on methods and properties avalable for Origin as server.

Easwar
OriginLab


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This m-file shows a basic example of how to communicate between a MATLAB client and an Origin Server application.
% This example does the following:
% -> Connects to Origin server application if an instance exists, or launches a new instance of Origin server
% -> Loads a previously customized Origin Project file which has a worksheet and a custom graph
% -> Sends some data over to the Origin worksheet, which then updates the graph
% -> Rescales the graph and copies the graph image to the system clipboard
%
% For documentation on all methods and properties supported by the Origin Automation Server, please refer to the
% Programming Help File, and the topic "Calling Origin from Other Applications (Automation Server Support)".
%
% Note: This m-file was tested only in MATLAB 6.1
% You may need to download a new DLL from the MathWorks website:
% ftp://ftp.mathworks.com/pub/tech-support/solutions/s29502/actxcli.dll
% and replace the older DLL found in the following MATLAB subfolder
% $MATLAB\toolbox\matlab\winfun\@activex\private\actxcli.dll
% to fix a bug in MATLAB ActiveX
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
function CreatePlotInOrigin()
%
% Obtain Origin COM Server object
% This will connect to an existing instance of Origin, or create a new one if none exist
originObj=actxserver('Origin.ApplicationSI');

% Make the Origin session visible
invoke(originObj, 'Execute', 'doc -mc 1;');

% Clear "dirty" flag in Origin to suppress prompt for saving current project
% You may want to replace this with code to handling of saving current project
invoke(originObj, 'IsModified', 'false');

% Load the custom project CreateOriginPlot.OPJ found in Samples area of Origin installation
invoke(originObj, 'Execute', 'syspath$=system.path.program$;');
strPath='';
strPath = invoke(originObj, 'LTStr', 'syspath$');
invoke(originObj, 'Load', strcat(strPath, 'Samples\\AutomationServer\\Matlab\\CreatePlotInOrigin.OPJ'));

% Create some data to send over to Origin - create three vectors
% This can be replaced with real data such as result of computation in MATLAB
mdata = [0.1:0.1:3; 10 * sin(0.1:0.1:3); 20 * cos(0.1:0.1:3)];
% Transpose the data so that it can be placed in Origin worksheet columns
mdata = mdata';
% Send this data over to the Data1 worksheet
invoke(originObj, 'PutWorksheet', 'Data1', mdata);

% Rescale the two layers in the graph and copy graph to clipboard
invoke(originObj, 'Execute', 'page.active = 1; layer - a; page.active = 2; layer - a;');
invoke(originObj, 'CopyPage', 'Graph1');

% You can now get the graph image from clipboard and paste in PowerPoint etc.
%
% end





Edited by - easwar on 07/19/2005 1:56:56 PM

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000