readmultvectors

Reads data from a given file. readmultvectors uses the CAE readers provided with Compose and supports a large set of file formats. The function has two main forms. See the Comments section for more information on these forms.

Syntax

readmultvectors(filename)

readmultvectors(filename, datacell)

readmultvectors(filename, type, startRequest, endRequest, startComponent, endComponent, timeStep)

readmultvectors(filename, subcase, type, startRequest, endRequest, startComponent, endComponent, timeStep)

readmultvectors(filename, type, startRequest, endRequest, startComponent, endComponent, timeRange)

readmultvectors(filename, subcase, type, startRequest, endRequest, startComponent, endComponent, timeRange)

Inputs

filename
Path of the file.
Type: string
datacell
Cell defining the data to read.
Type: cell
subcase
Subcase name or index in the file.
Type: string | int
type
Type name or index in the file.
Type: string | int
startRequest
First request name or index.
Type: string | int
endRequest
Last request name or index.
Type: string | int
startComponent
First component name or index.
Type: string | int
endComponent
Last component name or index.
Type: string | int
timeStep
Time step to extract (index).
Type: string | int
timeRange
Range of time steps to extract. Arguments are indices, not actual time values. Supported forms are: ALL (extract all time steps) , [i:j] (extract ith to jth index (inclusive)), [i,j,k,l] (extract the specified indices).
Type: string | int

Outputs

R
In the first form, the output is a cell array containing subcase, type, request, and component names and data.
In the second form,the output is a multidimensional matrix containing data. The first dimension is request, the second dimension is component, and the third dimension is data.

Example

Example 1 - readmultvectors example, where all the data is read. File without subcase.

output1=readmultvectors('ANGACC')
output1 = 
{
[1,1] Time
[1,2] Time
[1,3] Time
[1,4] [Matrix] 1 x 151
0  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  
...
137  138  139  140  141  142  143  144  145  146  147  148  149  150
[2,1] Angular Acceleration
[2,2] 50th% Hybrid3   - LOWER TORSO
[2,3] Res. ang. acc.
[2,4] [Matrix] 1 x 151
189.77340  74.61664  43.76210  22.01950  4.81345  18.73232  48.53254  64.71379  91.91729   
...
[22,1] Index
[22,2] Index
[22,3] Index
[22,4] [Matrix] 1 x 151
0  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  
...
137  138  139  140  141  142  143  144  145  146  147  148  149  150
}

Example 2 - readmultvectors example, where all the data from first subcase is read. File with subcase.

output1=readmultvectors('control_arm_sol111.pch')
output1 = 
{
[1,1] Frequency [Hz]
[1,2] Frequency [Hz]
[1,3] Frequency [Hz]
[1,4] [Matrix] 1 x 22
10.00000 10.25000 10.50000 10.75000 11.00000 11.25000 
...
14.50000 14.75000 15.00000 15.25000
...
[15,1] Index
[15,2] Index
[15,3] Index
[15,4] [Matrix] 1 x 22
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
}

Example 3 - readmultvectors example, where the data to read is defined as individual arguments (defining ranges for request and component). File without subcase.

file = 'ANGACC';
%%readmultvectors(filename, type, startRequest, endRequest, startComponent, endComponent, timeStep)
output2=readmultvectors(file, 'Angular Acceleration','50th% Hybrid3   - LOWER TORSO','50th% Hybrid3   - HEAD','X-comp. ang. acc.','Y-comp. ang. acc.','3')
output2 = 
[Matrix] 2 x 2
-0.05076 -21.82184
0.50626 9.58495

Example 4 - readmultvectors example, where the data to read is defined as individual arguments (defining ranges for request and component). File with subcase.

file = 'control_arm_sol111.pch';
%%readmultvectors(filename, subcase, type, startRequest, endRequest, startComponent, endComponent, timeStep)
output2=readmultvectors(file,'Subcase 2','Displacements','Point id 2086','Point id 2086','REL | X-Trans','REL | Y-Trans','10')
output2 = 
[Matrix] 1 x 2
-0.08723  0.00968

Example 5 - readmultvectors example, where the data to read is defined as individual arguments (defining ranges for request and component) and various options to define the time step are used. File with subcase.

file = 'control_arm_sol111.pch';
%%readmultvectors(filename, subcase, type, startRequest, endRequest, startComponent, endComponent, timeRange)
output21=readmultvectors(file,'Subcase 2','Displacements','Point id 2086','Point id 2086','REL | X-Trans','REL | Y-Trans','all')
output22=readmultvectors(file,'Subcase 2','Displacements','Point id 2086','Point id 2086','REL | X-Trans','REL | Y-Trans',[2:4])
output23=readmultvectors(file,'Subcase 2','Displacements','Point id 2086','Point id 2086','REL | X-Trans','REL | Y-Trans',[2,4])
output21 = 
slice(:, :, 1) = 
[Matrix] 1 x 2
-0.08723  0.00968
...
slice(:, :, 22) = 
[Matrix] 1 x 2
-0.03192  -0.00449

outp22 = 
slice(:, :, 1) = 
[Matrix] 1 x 2
-0.07904  0.04887
slice(:, :, 2) = 
[Matrix] 1 x 2
-0.12283  0.17936
slice(:, :, 3) = 
[Matrix] 1 x 2
-0.03330  -0.05166

outp23 = 
slice(:, :, 1) = 
[Matrix] 1 x 2
-0.07904  0.04887
slice(:, :, 2) = 
[Matrix] 1 x 2
-0.03330  -0.05166

Example 6 - readmultvectors example, where the data to read is defined in a cell. File with subcase.

file = 'control_arm_sol111.pch';
datacell=cell(1,4);
datacell{1,1} = 'Subcase 1';
datacell{1,2} = 'Displacements';
datacell{1,3} = 'Point id 2086';
datacell{1,4} = 'REL | X-Trans';
output3=readmultvectors(file,datacell)
output3 = 
{
[1,1] Subcase 1
[1,2] Displacements
[1,3] Point id 2086
[1,4] REL | X-Trans
[1,5] [Matrix] 1 x 22
0.08723  0.07904  0.12283  0.03330  0.04030  0.03332  ...  0.05043  0.03672  0.02253  0.03086  0.03192
}

Example 7 - readmultvectors example, where the data to read is defined in a cell. File without subcase.

file = 'ANGACC';
datacell=cell(1,3);
datacell{1,1} = 'Angular Acceleration';
datacell{1,2} = '50th% Hybrid3   - LOWER TORSO';
datacell{1,3} = 'Res. ang. acc.';
output4=readmultvectors(file,datacell)
output4 = 
{
[1,1] Angular Acceleration
[1,2] 50th% Hybrid3   - LOWER TORSO
[1,3] Res. ang. acc.
[1,4] [Matrix] 1 x 151
189.77340  74.61664  43.76210  22.01950  4.81345  18.73232  48.53254  64.71379  91.91729  143.70480  182.49480   
....
149.61480  142.19320  133.54260
}

Example 8 - readmultvectors example, where the data to read is defined as individual arguments (defining ranges for request and component) and various options to define the time step are used. File without subcase.

file = 'ANGACC';
%%readmultvectors(filename, type, startRequest, endRequest, startComponent, endComponent, timeRange)
output21=readmultvectors(file,'Angular Acceleration','50th% Hybrid3   - LOWER TORSO','50th% Hybrid3   - HEAD','X-comp. ang. acc.','Y-comp. ang. acc.','all')
output22=readmultvectors(file, 'Angular Acceleration','50th% Hybrid3   - LOWER TORSO','50th% Hybrid3   - HEAD','X-comp. ang. acc.','Y-comp. ang. acc.',[2:4])
output23=readmultvectors(file, 'Angular Acceleration','50th% Hybrid3   - LOWER TORSO','50th% Hybrid3   - HEAD','X-comp. ang. acc.','Y-comp. ang. acc.',[2,4])
output21 = 
slice(:, :, 1) =  
[[Matrix] 2 x 2
-3.17862 -189.74020
...
slice(:, :, 151) = 
[Matrix] 2 x 2
-78.59008 106.77130
...

outp22 = 
slice(:, :, 1) = 
[Matrix] 2 x 2
-0.48198 -74.61508
0.07418 -5.57428
slice(:, :, 2) = 
[Matrix] 2 x 2
0.07681 -43.72750
0.20371 3.57730
slice(:, :, 3) = 
[Matrix] 2 x 2
-0.05076 -21.82184
0.50626 9.58495

outp23 = 
slice(:, :, 1) = 
[Matrix] 2 x 2
-0.48198 -74.61508
0.07418 -5.57428
slice(:, :, 2) = 
[Matrix] 2 x 2
-0.05076 -21.82184
0.50626 9.58495

Comments

The first form for readmultvectors has two variants: 1a) The input is only the file name. It reads all the data from the file if no subcases present in the file, otherwise it reads all data from first subcase. 1b) The input is the filename and a data cell. It reads all data from the file for the requested data as defined in a cell, which contains subcase, type, request, and components. The second form also has two variants 2a) The input is the filename, subcase, type, request, component, and time step. It reads data for a single time step. 2b) The input is the filename, subcase, type, request, component, and time range of step. It reads data for a range of time steps. In this form, there is an option to specify all time steps. The definition of the subcase, type, request, and components to read can be made by mixing strings and indices. The input argument subcase is not required for files which do not have subcases. The time step can be a string or index. The time range accepts only indices or the string 'ALL'.