Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aa22364

Browse files
committed
Merge pull request arokem#2 from shabbychef/master
fixes related to R2007b
2 parents de1351f + ad5056d commit aa22364

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

pymatbridge/matlab/functions/JavaTcpServer.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,15 @@
5353
case 'write'
5454
if(~isa(data,'int8')), error('TCP:input','Data must be of type int8'); end
5555
try
56-
DataOutputStream(TCP.outputStream).write(data,0,length(data));
56+
% in older versions of matlab, this gives an error about
57+
% static constructors;
58+
%DataOutputStream(TCP.outputStream).write(data,0,length(data));
59+
dostr = DataOutputStream(TCP.outputStream);
60+
dostr.write(data,0,length(data));
5761
catch
5862
end
5963
try
64+
% this might also barf if you change it to flush(), I believe.
6065
DataOutputStream(TCP.outputStream).flush;
6166
catch
6267
end

pymatbridge/matlab/functions/text2header.m

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@
99
switch(lower(type))
1010
case 'get'
1111
header.Get.Filename=request_words{i}{2};
12-
header.Get.Protocol=request_words{i}{3};
12+
if (numel(request_words{i}) > 2)
13+
header.Get.Protocol=request_words{i}{3};
14+
else
15+
header.Get.Protocol = 'none_given'
16+
end
1317
case 'post'
1418
header.Post.Filename=request_words{i}{2};
15-
header.Post.Protocol=request_words{i}{3};
19+
if (numel(request_words{i}) > 2)
20+
header.Post.Protocol=request_words{i}{3};
21+
else
22+
header.Post.Protocol = 'none_given'
23+
end
1624
case 'host:'
1725
header.Host=rmvp(line(7:end));
1826
case 'user-agent:'
@@ -82,4 +90,4 @@
8290
otherwise
8391
disp('unknown')
8492
end
85-
end
93+
end

0 commit comments

Comments
 (0)