1

Dynamic simulation .out to matlab

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

Johannes.Thorleiksson's avatar
66
Johannes.Thorleiksson
asked 2013-01-29 07:45:06 -0500
edit flag offensive 0 remove flag 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's avatar JervisW (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's avatar Johannes.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's avatar Johannes.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's avatar JervisW (2013-01-31 22:52:56 -0500) edit
add a comment see more comments

2 Answers

0

Hello,

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

Best Regards,

Madjê

Madje's avatar
1
Madje
answered 2013-03-25 06:29:57 -0500
edit flag offensive 0 remove flag delete link

Comments

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

Johannes.Thorleiksson's avatar Johannes.Thorleiksson (2013-04-05 09:47:52 -0500) edit
add a comment see more comments
0

*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

AmirN's avatar
1
AmirN
answered 2017-07-07 03:26:17 -0500, updated 2017-07-12 06:33:05 -0500
edit flag offensive 0 remove flag delete link

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's avatar AmirN (2017-07-07 08:32:11 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer