This file is indexed.

/usr/share/octave/packages/io-2.4.5/pch2mat.m is in octave-io 2.4.5-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
%% Copyright (C) 2011-2016 Bilen Oytun Peksel <oytun.peksel@gmail.com>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions are met:
%%
%%    1 Redistributions of source code must retain the above copyright notice,
%%      this list of conditions and the following disclaimer.
%%    2 Redistributions in binary form must reproduce the above copyright
%%      notice, this list of conditions and the following disclaimer in the
%%      documentation and/or other materials provided with the distribution.
%%
%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''AS IS''
%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
%% ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
%% ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
%% DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
%% SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
%% CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
%% OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
%% OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

%% -*- texinfo -*-
%% @deftypefn {Function File} {@var{data} =} pch2mat (@var{filename})
%% Converts NASTRAN PCH file (SORT2) to a data structure and frequency vector. A
%% filename as a string is the only needed input.
%%
%% The output is in the form of struct. containing a freq vector n x 1 called
%% data.f, and the remaining data are in the form of subcases, point ids
%% and directions respectively. for ex. data.S1.p254686.x and they are n x 2
%%
%% @end deftypefn

function [data] = pch2mat(filename);

    %% Open the file and read the file line by line to form a line character array
    fid = fopen(filename);
    l = 1;
    while (~feof(fid))
        raw{l} = fgets(fid);
        l      = l + 1;
    end

    %% Determine Freq_count and number of lines for each case
    a          = find (strcmp ('$TITLE',raw));
    lines      = a(2) -a(1); %number of lines on each subcase and related point id
    freq_count = (lines-7)/4;

    %% Read from array
    C = length(raw) / lines; %number of subcase and related point id

    for k = 1 : C; %looping through every case
        scase = char(raw{(k-1) * lines + 3}(12:16));
        scase = genvarname(scase);
        pid   = char(raw{(k-1) * lines + 7}(16:25));
        pid   = genvarname(['p' pid]);
        if (k==1)
            data.f = zeros(freq_count,1);
        end;
        data.(scase).(pid).x  = zeros(freq_count,2);
        data.(scase).(pid).y  = zeros(freq_count,2);
        data.(scase).(pid).z  = zeros(freq_count,2);
        data.(scase).(pid).r1 = zeros(freq_count,2);
        data.(scase).(pid).r2 = zeros(freq_count,2);
        data.(scase).(pid).r3 = zeros(freq_count,2);
        i = (k-1) * lines + 8 ;
        j = 0;

        while( i <= (lines * k)) %loop for each case
            j=j+1;
            if (k==1)
                data.f(j) = str2double(raw{i}(5:17));
            end
            data.(scase).(pid).x(j,1)  = str2double(raw{i}(25:37));
            data.(scase).(pid).y(j,1)  = str2double(raw{i}(43:55));
            data.(scase).(pid).z(j,1)  = str2double(raw{i}(61:73));
            i=i+1;
            data.(scase).(pid).r1(j,1) = str2double(raw{i}(25:37));
            data.(scase).(pid).r2(j,1) = str2double(raw{i}(43:55));
            data.(scase).(pid).r3(j,1) = str2double(raw{i}(61:73));
            i=i+1;
            data.(scase).(pid).x(j,2)  = str2double(raw{i}(25:37));
            data.(scase).(pid).y(j,2)  = str2double(raw{i}(43:55));
            data.(scase).(pid).z(j,2)  = str2double(raw{i}(61:73));
            i=i+1;
            data.(scase).(pid).r1(j,2) = str2double(raw{i}(25:37));
            data.(scase).(pid).r2(j,2) = str2double(raw{i}(43:55));
            data.(scase).(pid).r3(j,2) = str2double(raw{i}(61:73));
            i=i+1;
        end
    end
end