First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
function [numberchannels,nameschannels,tomatlab]=pssout2matlab(inputfile)
names_channels=[];
channels_data=[];
number_channels=[];
tekst=[];
if nargin==0
[filename]=uigetfile('*.out','PSSE .out files'); % select file from disk (without input_file in function call)
fid=fopen(filename);
else
fid=fopen(input_file');
end
setstr(fread(fid,4,'char')');
setstr(fread(fid,4,'char')');
setstr(fread(fid,4,'char')');
number_channels=fread(fid,1,'float32');
fread(fid,1,'float32');
nameschannels=setstr(fread(fid,[32, numberchannels] ,'char'))';
nameschannels=strvcat('Time ',nameschannels);
tekst=setstr(fread(fid,[60, 2] ,'char'))';
channels_data=fread(fid,Inf,'float32');
kolona=(size(channelsdata,1)-2)/(numberchannels+2);
rezultat=reshape(channelsdata(1:kolona*(numberchannels+2)),number_channels+2,kolona)';
to_matlab=rezultat(:,2:size(rezultat,2));
fclose(fid);
numberchannels=numberchannels+1;
nameschannels=strcat(num2str([1:numberchannels]','%06.f'),'-',names_channels);
end
2 | No.2 Revision |
function [numberchannels,nameschannels,tomatlab]=pssout2matlab(inputfile)
names_channels=[];
channels_data=[];
number_channels=[];
tekst=[];
if nargin==0
[filename]=uigetfile('*.out','PSSE .out files'); % select file from disk (without input_file in function call)
fid=fopen(filename);
else
fid=fopen(input_file');
end
setstr(fread(fid,4,'char')');
setstr(fread(fid,4,'char')');
setstr(fread(fid,4,'char')');
number_channels=fread(fid,1,'float32');
fread(fid,1,'float32');
nameschannels=setstr(fread(fid,[32, numberchannels] ,'char'))';
nameschannels=strvcat('Time ',nameschannels);
tekst=setstr(fread(fid,[60, 2] ,'char'))';
channels_data=fread(fid,Inf,'float32');
kolona=(size(channelsdata,1)-2)/(numberchannels+2);
rezultat=reshape(channelsdata(1:kolona*(numberchannels+2)),number_channels+2,kolona)';
to_matlab=rezultat(:,2:size(rezultat,2));
fclose(fid);
numberchannels=numberchannels+1;
nameschannels=strcat(num2str([1:numberchannels]','%06.f'),'-',names_channels);
end
3 | No.3 Revision |
copying all channels from out file into matlab:
function [numberchannels,nameschannels,tomatlab]=pssout2matlab(inputfile)
names_channels=[];
channels_data=[];
number_channels=[];
tekst=[];
if nargin==0
[filename]=uigetfile('*.out','PSSE .out files'); % select file from disk (without input_file in function call)
fid=fopen(filename);
else
fid=fopen(input_file');
end
setstr(fread(fid,4,'char')');
setstr(fread(fid,4,'char')');
setstr(fread(fid,4,'char')');
number_channels=fread(fid,1,'float32');
fread(fid,1,'float32');
nameschannels=setstr(fread(fid,[32, numberchannels] ,'char'))';
nameschannels=strvcat('Time ',nameschannels);
tekst=setstr(fread(fid,[60, 2] ,'char'))';
channels_data=fread(fid,Inf,'float32');
kolona=(size(channelsdata,1)-2)/(numberchannels+2);
rezultat=reshape(channelsdata(1:kolona*(numberchannels+2)),number_channels+2,kolona)';
to_matlab=rezultat(:,2:size(rezultat,2));
fclose(fid);
numberchannels=numberchannels+1;
nameschannels=strcat(num2str([1:numberchannels]','%06.f'),'-',names_channels);
end
4 | No.4 Revision |
copying all channels from out file into matlab:
function [numberchannels,nameschannels,tomatlab]=pssout2matlab(inputfile)
names_channels=[];
channels_data=[];
number_channels=[];
tekst=[];
if nargin==0
[filename]=uigetfile('*.out','PSSE .out files'); % select file from disk (without input_file in function call)
fid=fopen(filename);
else
fid=fopen(input_file');
end
setstr(fread(fid,4,'char')');
setstr(fread(fid,4,'char')');
setstr(fread(fid,4,'char')');
number_channels=fread(fid,1,'float32');
fread(fid,1,'float32');
nameschannels=setstr(fread(fid,[32, numberchannels] ,'char'))';
nameschannels=strvcat('Time ',nameschannels);
tekst=setstr(fread(fid,[60, 2] ,'char'))';
channels_data=fread(fid,Inf,'float32');
kolona=(size(channelsdata,1)-2)/(numberchannels+2);
rezultat=reshape(channelsdata(1:kolona*(numberchannels+2)),number_channels+2,kolona)';
to_matlab=rezultat(:,2:size(rezultat,2));
fclose(fid);
numberchannels=numberchannels+1;
nameschannels=strcat(num2str([1:numberchannels]','%06.f'),'-',names_channels);
end
5 | No.5 Revision |
copying all channels from out file into matlab:function [numberchannels,nameschannels,tomatlab]=pssout2matlab(inputfile)
function [numberchannels,nameschannels,tomatlab]=pssout2matlab(inputfile)nameschannels=[];
names_channels=[];channelsdata=[];
channels_data=[];
number_channels=[];numberchannels=[];
tekst=[];
if nargin==0
[filename]=uigetfile('*.out','PSSE .out files'); % select file from disk (without input_file inputfile in function call)
fid=fopen(filename);
else
fid=fopen(input_file');fid=fopen(inputfile');
end
setstr(fread(fid,4,'char')');
setstr(fread(fid,4,'char')');
setstr(fread(fid,4,'char')');
number_channels=fread(fid,1,'float32');numberchannels=fread(fid,1,'float32');
fread(fid,1,'float32');
nameschannels=setstr(fread(fid,[32, numberchannels] nameschannels=setstr(fread(fid,[32, numberchannels] ,'char'))';
nameschannels=strvcat('Time ',nameschannels);nameschannels=strvcat(strcat('Time',blanks(28)),nameschannels);
tekst=setstr(fread(fid,[60, 2] ,'char'))';
channels_data=fread(fid,Inf,'float32');channelsdata=fread(fid,Inf,'float32');
kolona=(size(channelsdata,1)-2)/(numberchannels+2);kolona=(size(channelsdata,1)-2)/(numberchannels+2);
rezultat=reshape(channelsdata(1:kolona*(numberchannels+2)),number_channels+2,kolona)';rezultat=reshape(channelsdata(1:kolona*(numberchannels+2)),numberchannels+2,kolona)';
to_matlab=rezultat(:,2:size(rezultat,2));tomatlab=rezultat(:,2:size(rezultat,2));
fclose(fid);
numberchannels=numberchannels+1;numberchannels=numberchannels+1;
nameschannels=strcat(num2str([1:numberchannels]','%06.f'),'-',names_channels);nameschannels=strcat(num2str([1:numberchannels]','%06.f'),'-',nameschannels);
end
6 | No.6 Revision |
Copying of all channels into matlab workspace
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
7 | No.7 Revision |
Copying of all channels into matlab workspaceworkspace (as possibility for matlab users)
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
8 | No.8 Revision |
Copying of all channels into matlab workspace (as possibility for matlab users)
Download matlab function and example of using:
https://drive.google.com/drive/folders/0BxDSoDW3zV09MkhkbnZuLWxwY28?usp=sharing
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