Ask Your Question
1

Dynamic simulation .out to matlab

asked 2013-01-29 07:45:06 -0500

Johannes.Thorleiksson gravatar image

Hey guys

I have been using excel to manage my .out files but I want to import the data into matlab now since the datasets are getting bigger and bigger.

Is there a function that would do this for me similar as dyntools exports to excel.

Best Regards Johannnes

edit retag flag offensive close merge delete

Comments

There isn't a ready-made function. But you could write something that exports to CSV. Then import that to matlab. Does it take a long time to write to excel?

JervisW gravatar imageJervisW ( 2013-01-29 16:13:07 -0500 )edit

Hey man, I am currently exporting all the out files and the channels I want to excel and then I should be able to open it in matlab but that is a alot of mouseclicks :)

Johannes.Thorleiksson gravatar imageJohannes.Thorleiksson ( 2013-01-30 00:53:24 -0500 )edit

I actually noticed an interesting problem. When I run many dynamic simulations the size of the .out files seem to grow althoguh I change the name and reopen the channels so I can run limited amount of dynamic simulations.

Johannes.Thorleiksson gravatar imageJohannes.Thorleiksson ( 2013-01-30 00:55:08 -0500 )edit

Yeah, sorry I wasn't much help on that one. My suggestion had more to do with writing directly to a flat CSV file and then in Matlab reading that CSV file in. This way you skip Excel entirely.

JervisW gravatar imageJervisW ( 2013-01-31 22:52:56 -0500 )edit

2 answers

Sort by » oldest newest most voted
0

answered 2013-03-25 06:29:57 -0500

Madje gravatar image

Hello,

I do you read the .out file in Excel? Mine is just a bunch of garbage.

Best Regards,

Madjê

edit flag offensive delete link more

Comments

Hey Madje Yes I use dyntools to export the .out files and the channels I want to excel. Best Regards Johannes

Johannes.Thorleiksson gravatar imageJohannes.Thorleiksson ( 2013-04-05 09:47:52 -0500 )edit
0

answered 2017-07-07 03:26:17 -0500

AmirN gravatar image

updated 2017-07-12 06:33:05 -0500

*Copying of all channels into matlab workspace (as possibility for matlab users)*

Download matlab function and example of using:

https://drive.google.com/drive/folder...

function [numberchannels,nameschannels,tomatlab]=pssout2matlab(inputfile)

nameschannels=[];

channelsdata=[];

numberchannels=[];

tekst=[];

if nargin==0

[filename]=uigetfile('*.out','PSSE .out files'); % select file from disk (without inputfile in function call)

fid=fopen(filename);

else

fid=fopen(inputfile');

end

setstr(fread(fid,4,'char')');

setstr(fread(fid,4,'char')');

setstr(fread(fid,4,'char')');

numberchannels=fread(fid,1,'float32');

fread(fid,1,'float32');

nameschannels=setstr(fread(fid,[32, numberchannels] ,'char'))';

nameschannels=strvcat(strcat('Time',blanks(28)),nameschannels);

tekst=setstr(fread(fid,[60, 2] ,'char'))';

channelsdata=fread(fid,Inf,'float32');

kolona=(size(channelsdata,1)-2)/(numberchannels+2);

rezultat=reshape(channelsdata(1:kolona*(numberchannels+2)),numberchannels+2,kolona)';

tomatlab=rezultat(:,2:size(rezultat,2));

fclose(fid);

numberchannels=numberchannels+1;

nameschannels=strcat(num2str([1:numberchannels]','%06.f'),'-',nameschannels);

end

edit flag offensive delete link more

Comments

Johannes.Thorleiksson, you have to delete all channels after one dynamic simulation, and then again set channels using python... then the sizes of out files doesn't grow during simulations

AmirN gravatar imageAmirN ( 2017-07-07 08:32:11 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Stats

Asked: 2013-01-29 07:45:06 -0500

Seen: 1,733 times

Last updated: Jul 12 '17