File: StructsFileTest.m

package info (click to toggle)
psychtoolbox-3 3.0.14.20170103%2Bgit6-g605ff5c.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 103,044 kB
  • ctags: 69,483
  • sloc: ansic: 167,371; cpp: 11,232; objc: 4,708; sh: 1,875; python: 383; php: 344; makefile: 207; java: 113
file content (35 lines) | stat: -rw-r--r-- 684 bytes parent folder | download | duplicates (3)
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
% StructsFileTest
%
% Test the routines for reading and writing numeric structs
% into and out of text files.
%
% 6/16/03  dhb  Wrote it.

% Clear
clear; close all;

% Fill in some structs
theStructs(1).field1 = 'joe';
theStructs(1).field2 = 2;
theStructs(1).field3 = 3;
theStructs(1).field4 = 4;

theStructs(2).field1 = 'jim';
theStructs(2).field2 = 6;
theStructs(2).field3 = 7;
theStructs(2).field4 = 8;

theStructs(3).field1 = 'bob';
theStructs(3).field2 = 10;
theStructs(3).field3 = 11;
theStructs(3).field4 = 12;

% Write the array out
WriteStructsToText('foo.txt',theStructs);

% Read it back in
newStructs = ReadStructsFromText('foo.txt');

% Delete test file.
delete foo.txt