[1] | 1 | function test_inq ( ncfile ) |
---|
| 2 | % TEST_INQ |
---|
| 3 | % |
---|
| 4 | % Tests number of dimensions, variables, global attributes, record dimension for |
---|
| 5 | % foo.nc. Also tests helper routines, "nc_inq_ndims", "nc_inq_nvars", "nc_inq_ncatts". |
---|
| 6 | % |
---|
| 7 | % Tests bad ncid as well. |
---|
| 8 | % |
---|
| 9 | % Test 1: Normal retrieval |
---|
| 10 | % Test 2: Bad ncid. |
---|
| 11 | % Test 3: Empty set ncid. |
---|
| 12 | % Test 4: Non numeric ncid |
---|
| 13 | % Test 5: INQ_NDIMS normal retrieval |
---|
| 14 | % Test 6: INQ_NDIMS Bad ncid. |
---|
| 15 | % Test 7: INQ_NDIMS Empty set ncid. |
---|
| 16 | % Test 8: INQ_NDIMS Non numeric ncid |
---|
| 17 | % Test 9: INQ_NVARS normal retrieval |
---|
| 18 | % Test 10: INQ_NVARS Bad ncid. |
---|
| 19 | % Test 11: INQ_NVARS Empty set ncid. |
---|
| 20 | % Test 12: INQ_NVARS Non numeric ncid |
---|
| 21 | % Test 13: INQ_NATTS normal retrieval |
---|
| 22 | % Test 14: INQ_NATTS Bad ncid. |
---|
| 23 | % Test 15: INQ_NATTS Empty set ncid. |
---|
| 24 | % Test 16: INQ_NATTS Non numeric ncid |
---|
| 25 | |
---|
| 26 | if nargin == 0 |
---|
| 27 | ncfile = 'foo.nc'; |
---|
| 28 | end |
---|
| 29 | create_testfile ( ncfile ); |
---|
| 30 | |
---|
| 31 | test_001 ( ncfile ); |
---|
| 32 | test_002 ( ncfile ); |
---|
| 33 | test_003 ( ncfile ); |
---|
| 34 | test_004 ( ncfile ); |
---|
| 35 | test_005 ( ncfile ); |
---|
| 36 | test_006 ( ncfile ); |
---|
| 37 | test_007 ( ncfile ); |
---|
| 38 | test_008 ( ncfile ); |
---|
| 39 | test_009 ( ncfile ); |
---|
| 40 | test_010 ( ncfile ); |
---|
| 41 | test_011 ( ncfile ); |
---|
| 42 | test_012 ( ncfile ); |
---|
| 43 | test_013 ( ncfile ); |
---|
| 44 | test_014 ( ncfile ); |
---|
| 45 | test_015 ( ncfile ); |
---|
| 46 | test_016 ( ncfile ); |
---|
| 47 | |
---|
| 48 | fprintf ( 1, 'INQ succeeded\n' ); |
---|
| 49 | fprintf ( 1, 'INQ_NDIMS succeeded\n' ); |
---|
| 50 | fprintf ( 1, 'INQ_NVARS succeeded\n' ); |
---|
| 51 | fprintf ( 1, 'INQ_NATTS succeeded\n' ); |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | function create_testfile ( ncfile ) |
---|
| 55 | |
---|
| 56 | % |
---|
| 57 | % Create a netcdf file with |
---|
| 58 | [ncid, status] = mexnc ( 'create', ncfile, nc_clobber_mode ); |
---|
| 59 | if status, error ( mexnc(strerror,status) ), end |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | % |
---|
| 63 | % DIMDEF |
---|
| 64 | [xdimid, status] = mexnc ( 'def_dim', ncid, 'x', 20 ); |
---|
| 65 | if status, error ( mexnc(strerror,status) ), end |
---|
| 66 | |
---|
| 67 | [ydimid, status] = mexnc ( 'def_dim', ncid, 'y', 24 ); |
---|
| 68 | if status, error ( mexnc(strerror,status) ), end |
---|
| 69 | |
---|
| 70 | [zdimid, status] = mexnc ( 'def_dim', ncid, 'z', 32 ); |
---|
| 71 | if status, error ( mexnc(strerror,status) ), end |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | % |
---|
| 75 | % VARDEF |
---|
| 76 | [xdvarid, status] = mexnc ( 'def_var', ncid, 'x_double', 'double', 1, xdimid ); |
---|
| 77 | if status, error ( mexnc(strerror,status) ), end |
---|
| 78 | |
---|
| 79 | [xmvarid, status] = mexnc ( 'def_var', ncid, 'xm_double', 'double', 3, [zdimid ydimid xdimid] ); |
---|
| 80 | if status, error ( mexnc(strerror,status) ), end |
---|
| 81 | |
---|
| 82 | [xfvarid, status] = mexnc ( 'def_var', ncid, 'x_float', 'float', 1, xdimid ); |
---|
| 83 | if status, error ( mexnc(strerror,status) ), end |
---|
| 84 | |
---|
| 85 | [xmvarid, status] = mexnc ( 'def_var', ncid, 'xm_float', 'float', 3, [zdimid ydimid xdimid] ); |
---|
| 86 | if status, error ( mexnc(strerror,status) ), end |
---|
| 87 | |
---|
| 88 | [xlvarid, status] = mexnc ( 'def_var', ncid, 'x_long', 'long', 1, xdimid ); |
---|
| 89 | if status, error ( mexnc(strerror,status) ), end |
---|
| 90 | |
---|
| 91 | [xmvarid, status] = mexnc ( 'def_var', ncid, 'xm_int', 'long', 3, [zdimid ydimid xdimid] ); |
---|
| 92 | if status, error ( mexnc(strerror,status) ), end |
---|
| 93 | |
---|
| 94 | [x_short_varid, status] = mexnc ( 'def_var', ncid, 'x_short', 'short', 1, xdimid ); |
---|
| 95 | if status, error ( mexnc(strerror,status) ), end |
---|
| 96 | |
---|
| 97 | [xmvarid, status] = mexnc ( 'def_var', ncid, 'xm_short', 'short', 3, [zdimid ydimid xdimid] ); |
---|
| 98 | if status, error ( mexnc(strerror,status) ), end |
---|
| 99 | |
---|
| 100 | [x_byte_varid, status] = mexnc ( 'def_var', ncid, 'x_byte', 'byte', 1, xdimid ); |
---|
| 101 | if status, error ( mexnc(strerror,status) ), end |
---|
| 102 | |
---|
| 103 | [xmvarid, status] = mexnc ( 'def_var', ncid, 'xm_byte', 'byte', 3, [zdimid ydimid xdimid] ); |
---|
| 104 | if status, error ( mexnc(strerror,status) ), end |
---|
| 105 | |
---|
| 106 | [x_char_varid, status] = mexnc ( 'def_var', ncid, 'x_char', 'char', 1, xdimid ); |
---|
| 107 | if status, error ( mexnc(strerror,status) ), end |
---|
| 108 | |
---|
| 109 | [xmvarid, status] = mexnc ( 'def_var', ncid, 'xm_char', 'char', 3, [zdimid ydimid xdimid] ); |
---|
| 110 | if status, error ( mexnc(strerror,status) ), end |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | |
---|
| 114 | % |
---|
| 115 | % Define some attributes |
---|
| 116 | attvalue = 'this is a test'; |
---|
| 117 | attlen = length(attvalue); |
---|
| 118 | status = mexnc ( 'put_att_text', ncid, -1, 'test_global_attributes', 'char', attlen, attvalue ); |
---|
| 119 | if status, error ( mexnc(strerror,status) ), end |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | [status] = mexnc ( 'enddef', ncid ); |
---|
| 123 | if status, error ( mexnc(strerror,status) ), end |
---|
| 124 | |
---|
| 125 | return |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | |
---|
| 129 | |
---|
| 130 | |
---|
| 131 | |
---|
| 132 | |
---|
| 133 | |
---|
| 134 | |
---|
| 135 | function test_001 ( ncfile ) |
---|
| 136 | |
---|
| 137 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 138 | if status, error ( mexnc(strerror,status) ), end |
---|
| 139 | |
---|
| 140 | [ndims, nvars, natts, recdim, status] = mexnc('INQ', ncid); |
---|
| 141 | if status, error ( mexnc(strerror,status) ), end |
---|
| 142 | |
---|
| 143 | if ndims ~= 3 |
---|
| 144 | msg = sprintf ( 'INQ returned %d dimensions when there should only have been 1\n', ndims ); |
---|
| 145 | error ( msg ); |
---|
| 146 | end |
---|
| 147 | |
---|
| 148 | if nvars ~= 12 |
---|
| 149 | msg = sprintf ( 'INQ returned %d variables when there should have been 12\n', nvars ); |
---|
| 150 | error ( msg ); |
---|
| 151 | end |
---|
| 152 | |
---|
| 153 | if natts ~= 1 |
---|
| 154 | msg = sprintf ( 'INQ returned %d attributes when there should have been 1\n', natts ); |
---|
| 155 | error ( msg ); |
---|
| 156 | end |
---|
| 157 | |
---|
| 158 | if recdim ~= -1 |
---|
| 159 | msg = sprintf ( 'INQ returned an unlimited dimension when there should not have been one\n' ); |
---|
| 160 | error ( msg ); |
---|
| 161 | end |
---|
| 162 | |
---|
| 163 | mexnc ( 'close', ncid ); |
---|
| 164 | |
---|
| 165 | return |
---|
| 166 | |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | |
---|
| 173 | function test_002 ( ncfile ) |
---|
| 174 | |
---|
| 175 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 176 | if status, error ( mexnc(strerror,status) ), end |
---|
| 177 | |
---|
| 178 | |
---|
| 179 | % Test 2: Bad ncid. |
---|
| 180 | testid = 'Test 2'; |
---|
| 181 | [ndims, nvars, natts, recdim, status] = mexnc('INQ', -2000); |
---|
| 182 | if ( status == 0 ) |
---|
| 183 | err_msg = sprintf ( '%s: %s: Succeeded when it should have failed\n', mfilename, testid ); |
---|
| 184 | error ( err_msg ); |
---|
| 185 | end |
---|
| 186 | |
---|
| 187 | mexnc ( 'close', ncid ); |
---|
| 188 | |
---|
| 189 | return |
---|
| 190 | |
---|
| 191 | |
---|
| 192 | |
---|
| 193 | |
---|
| 194 | |
---|
| 195 | |
---|
| 196 | |
---|
| 197 | |
---|
| 198 | function test_003 ( ncfile ) |
---|
| 199 | |
---|
| 200 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 201 | if status, error ( mexnc(strerror,status) ), end |
---|
| 202 | |
---|
| 203 | % Test 3: Empty set ncid. |
---|
| 204 | testid = 'Test 3'; |
---|
| 205 | try |
---|
| 206 | [ndims, nvars, natts, recdim, status] = mexnc('INQ', [] ); |
---|
| 207 | err_msg = sprintf ( '%s: %s: Succeeded when it should have failed\n', mfilename, testid ); |
---|
| 208 | error ( err_msg ); |
---|
| 209 | end |
---|
| 210 | |
---|
| 211 | mexnc ( 'close', ncid ); |
---|
| 212 | |
---|
| 213 | return |
---|
| 214 | |
---|
| 215 | |
---|
| 216 | |
---|
| 217 | |
---|
| 218 | |
---|
| 219 | function test_004 ( ncfile ) |
---|
| 220 | |
---|
| 221 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 222 | if status, error ( mexnc(strerror,status) ), end |
---|
| 223 | |
---|
| 224 | % Test 4: Non numeric ncid |
---|
| 225 | testid = 'Test 4'; |
---|
| 226 | try |
---|
| 227 | [ndims, nvars, natts, recdim, status] = mexnc('INQ', 'blah' ); |
---|
| 228 | err_msg = sprintf ( '%s: %s: Succeeded when it should have failed\n', mfilename, testid ); |
---|
| 229 | error ( err_msg ); |
---|
| 230 | end |
---|
| 231 | |
---|
| 232 | mexnc ( 'close', ncid ); |
---|
| 233 | |
---|
| 234 | return |
---|
| 235 | |
---|
| 236 | |
---|
| 237 | |
---|
| 238 | |
---|
| 239 | |
---|
| 240 | |
---|
| 241 | function test_005 ( ncfile ) |
---|
| 242 | |
---|
| 243 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 244 | if status, error ( mexnc(strerror,status) ), end |
---|
| 245 | |
---|
| 246 | [ndims, status] = mexnc('INQ_NDIMS', ncid); |
---|
| 247 | if ( status ~= 0 ) |
---|
| 248 | msg = sprintf ( '%s: %s: ''%s''', mfilename, testid, mexnc ( 'strerror', status ) ); |
---|
| 249 | error ( msg ); |
---|
| 250 | end |
---|
| 251 | |
---|
| 252 | if ndims ~= 3 |
---|
| 253 | msg = sprintf ( 'INQ_NDIMS returned %d dimensions when there should only have been 1\n', ndims ); |
---|
| 254 | error ( msg ); |
---|
| 255 | end |
---|
| 256 | |
---|
| 257 | mexnc ( 'close', ncid ); |
---|
| 258 | |
---|
| 259 | return |
---|
| 260 | |
---|
| 261 | |
---|
| 262 | |
---|
| 263 | |
---|
| 264 | |
---|
| 265 | |
---|
| 266 | |
---|
| 267 | function test_006 ( ncfile ) |
---|
| 268 | |
---|
| 269 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 270 | if status, error ( mexnc(strerror,status) ), end |
---|
| 271 | |
---|
| 272 | |
---|
| 273 | testid = 'Test 6'; |
---|
| 274 | [ndims, status] = mexnc('INQ_NDIMS', -2000); |
---|
| 275 | if ( status == 0 ) |
---|
| 276 | msg = sprintf ( '%s: %s: ''%s''', mfilename, testid, mexnc ( 'strerror', status ) ); |
---|
| 277 | error ( msg ); |
---|
| 278 | end |
---|
| 279 | |
---|
| 280 | mexnc ( 'close', ncid ); |
---|
| 281 | |
---|
| 282 | return |
---|
| 283 | |
---|
| 284 | |
---|
| 285 | |
---|
| 286 | |
---|
| 287 | |
---|
| 288 | |
---|
| 289 | |
---|
| 290 | |
---|
| 291 | |
---|
| 292 | |
---|
| 293 | |
---|
| 294 | |
---|
| 295 | |
---|
| 296 | function test_007 ( ncfile ) |
---|
| 297 | |
---|
| 298 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 299 | if status, error ( mexnc(strerror,status) ), end |
---|
| 300 | |
---|
| 301 | testid = 'Test 7'; |
---|
| 302 | try |
---|
| 303 | [ndims, status] = mexnc('INQ_NDIMS', [] ); |
---|
| 304 | err_msg = sprintf ( '%s: %s: Succeeded when it should have failed\n', mfilename, testid ); |
---|
| 305 | error ( err_msg ); |
---|
| 306 | end |
---|
| 307 | |
---|
| 308 | mexnc ( 'close', ncid ); |
---|
| 309 | |
---|
| 310 | return |
---|
| 311 | |
---|
| 312 | |
---|
| 313 | |
---|
| 314 | |
---|
| 315 | |
---|
| 316 | |
---|
| 317 | |
---|
| 318 | |
---|
| 319 | |
---|
| 320 | |
---|
| 321 | function test_008 ( ncfile ) |
---|
| 322 | |
---|
| 323 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 324 | if status, error ( mexnc(strerror,status) ), end |
---|
| 325 | |
---|
| 326 | testid = 'Test 8'; |
---|
| 327 | try |
---|
| 328 | [ndims, status] = mexnc('INQ_NDIMS', 'blah' ); |
---|
| 329 | err_msg = sprintf ( '%s: %s: Succeeded when it should have failed\n', mfilename, testid ); |
---|
| 330 | error ( err_msg ); |
---|
| 331 | end |
---|
| 332 | |
---|
| 333 | mexnc ( 'close', ncid ); |
---|
| 334 | |
---|
| 335 | return |
---|
| 336 | |
---|
| 337 | |
---|
| 338 | |
---|
| 339 | |
---|
| 340 | |
---|
| 341 | |
---|
| 342 | |
---|
| 343 | |
---|
| 344 | |
---|
| 345 | function test_009 ( ncfile ) |
---|
| 346 | |
---|
| 347 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 348 | if status, error ( mexnc(strerror,status) ), end |
---|
| 349 | |
---|
| 350 | % Test 9: INQ_NVARS Normal retrieval |
---|
| 351 | testid = 'Test 9'; |
---|
| 352 | [nvars, status] = mexnc('INQ_NVARS', ncid); |
---|
| 353 | if ( status ~= 0 ) |
---|
| 354 | msg = sprintf ( '%s: %s: ''%s''', mfilename, testid, mexnc ( 'strerror', status ) ); |
---|
| 355 | error ( msg ); |
---|
| 356 | end |
---|
| 357 | |
---|
| 358 | if nvars ~= 12 |
---|
| 359 | msg = sprintf ( 'INQ_NVARS returned %d dimensions when there should have been 12\n', nvars ); |
---|
| 360 | error ( msg ); |
---|
| 361 | end |
---|
| 362 | |
---|
| 363 | mexnc ( 'close', ncid ); |
---|
| 364 | |
---|
| 365 | return |
---|
| 366 | |
---|
| 367 | |
---|
| 368 | |
---|
| 369 | |
---|
| 370 | |
---|
| 371 | |
---|
| 372 | |
---|
| 373 | function test_010 ( ncfile ) |
---|
| 374 | |
---|
| 375 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 376 | if status, error ( mexnc(strerror,status) ), end |
---|
| 377 | |
---|
| 378 | % Test 10: INQ_NVARS Bad ncid. |
---|
| 379 | testid = 'Test 10'; |
---|
| 380 | [nvars, status] = mexnc('INQ_NVARS', -2000); |
---|
| 381 | if ( status == 0 ) |
---|
| 382 | msg = sprintf ( '%s: %s: ''%s''', mfilename, testid, mexnc ( 'strerror', status ) ); |
---|
| 383 | error ( msg ); |
---|
| 384 | end |
---|
| 385 | |
---|
| 386 | mexnc ( 'close', ncid ); |
---|
| 387 | |
---|
| 388 | return |
---|
| 389 | |
---|
| 390 | |
---|
| 391 | |
---|
| 392 | |
---|
| 393 | |
---|
| 394 | |
---|
| 395 | |
---|
| 396 | |
---|
| 397 | |
---|
| 398 | |
---|
| 399 | |
---|
| 400 | |
---|
| 401 | |
---|
| 402 | function test_011 ( ncfile ) |
---|
| 403 | |
---|
| 404 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 405 | if status, error ( mexnc(strerror,status) ), end |
---|
| 406 | |
---|
| 407 | % Test 11: INQ_NVARS Empty set ncid. |
---|
| 408 | testid = 'Test 11'; |
---|
| 409 | try |
---|
| 410 | [nvars, status] = mexnc('INQ_NVARS', [] ); |
---|
| 411 | err_msg = sprintf ( '%s: %s: Succeeded when it should have failed\n', mfilename, testid ); |
---|
| 412 | error ( err_msg ); |
---|
| 413 | end |
---|
| 414 | |
---|
| 415 | mexnc ( 'close', ncid ); |
---|
| 416 | |
---|
| 417 | return |
---|
| 418 | |
---|
| 419 | |
---|
| 420 | |
---|
| 421 | |
---|
| 422 | |
---|
| 423 | function test_012 ( ncfile ) |
---|
| 424 | |
---|
| 425 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 426 | if status, error ( mexnc(strerror,status) ), end |
---|
| 427 | |
---|
| 428 | % Test 12: Non numeric ncid |
---|
| 429 | testid = 'Test 12'; |
---|
| 430 | try |
---|
| 431 | [nvars, status] = mexnc('INQ_NVARS', 'blah' ); |
---|
| 432 | err_msg = sprintf ( '%s: %s: Succeeded when it should have failed\n', mfilename, testid ); |
---|
| 433 | error ( err_msg ); |
---|
| 434 | end |
---|
| 435 | |
---|
| 436 | mexnc ( 'close', ncid ); |
---|
| 437 | |
---|
| 438 | return |
---|
| 439 | |
---|
| 440 | |
---|
| 441 | |
---|
| 442 | |
---|
| 443 | |
---|
| 444 | |
---|
| 445 | |
---|
| 446 | |
---|
| 447 | |
---|
| 448 | |
---|
| 449 | |
---|
| 450 | function test_013 ( ncfile ) |
---|
| 451 | |
---|
| 452 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 453 | if status, error ( mexnc(strerror,status) ), end |
---|
| 454 | |
---|
| 455 | % Test 13: INQ_NATTS Normal retrieval |
---|
| 456 | testid = 'Test 13'; |
---|
| 457 | [natts, status] = mexnc('INQ_NATTS', ncid); |
---|
| 458 | if ( status ~= 0 ) |
---|
| 459 | msg = sprintf ( '%s: %s: ''%s''', mfilename, testid, mexnc ( 'strerror', status ) ); |
---|
| 460 | error ( msg ); |
---|
| 461 | end |
---|
| 462 | |
---|
| 463 | if natts ~= 1 |
---|
| 464 | msg = sprintf ( 'INQ_NATTS returned %d attributes when there should have been 1\n', natts ); |
---|
| 465 | error ( msg ); |
---|
| 466 | end |
---|
| 467 | |
---|
| 468 | mexnc ( 'close', ncid ); |
---|
| 469 | |
---|
| 470 | return |
---|
| 471 | |
---|
| 472 | |
---|
| 473 | |
---|
| 474 | |
---|
| 475 | |
---|
| 476 | |
---|
| 477 | |
---|
| 478 | |
---|
| 479 | function test_014 ( ncfile ) |
---|
| 480 | |
---|
| 481 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 482 | if status, error ( mexnc(strerror,status) ), end |
---|
| 483 | |
---|
| 484 | % Test 14: INQ_NATTS Bad ncid. |
---|
| 485 | testid = 'Test 14'; |
---|
| 486 | [natts, status] = mexnc('INQ_NATTS', -2000); |
---|
| 487 | if ( status == 0 ) |
---|
| 488 | msg = sprintf ( '%s: %s: ''%s''', mfilename, testid, mexnc ( 'strerror', status ) ); |
---|
| 489 | error ( msg ); |
---|
| 490 | end |
---|
| 491 | |
---|
| 492 | mexnc ( 'close', ncid ); |
---|
| 493 | |
---|
| 494 | return |
---|
| 495 | |
---|
| 496 | |
---|
| 497 | |
---|
| 498 | |
---|
| 499 | |
---|
| 500 | |
---|
| 501 | |
---|
| 502 | |
---|
| 503 | |
---|
| 504 | function test_015 ( ncfile ) |
---|
| 505 | |
---|
| 506 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 507 | if status, error ( mexnc(strerror,status) ), end |
---|
| 508 | |
---|
| 509 | % Test 15: INQ_NATTS Empty set ncid. |
---|
| 510 | testid = 'Test 15'; |
---|
| 511 | try |
---|
| 512 | [natts, status] = mexnc('INQ_NATTS', [] ); |
---|
| 513 | err_msg = sprintf ( '%s: %s: Succeeded when it should have failed\n', mfilename, testid ); |
---|
| 514 | error ( err_msg ); |
---|
| 515 | end |
---|
| 516 | |
---|
| 517 | mexnc ( 'close', ncid ); |
---|
| 518 | |
---|
| 519 | return |
---|
| 520 | |
---|
| 521 | |
---|
| 522 | |
---|
| 523 | |
---|
| 524 | |
---|
| 525 | |
---|
| 526 | function test_016 ( ncfile ) |
---|
| 527 | |
---|
| 528 | [ncid, status] = mexnc('open', ncfile, nc_nowrite_mode ); |
---|
| 529 | if status, error ( mexnc(strerror,status) ), end |
---|
| 530 | |
---|
| 531 | |
---|
| 532 | testid = 'Test 16'; |
---|
| 533 | try |
---|
| 534 | [natts, status] = mexnc('INQ_NATTS', 'blah' ); |
---|
| 535 | err_msg = sprintf ( '%s: %s: Succeeded when it should have failed\n', mfilename, testid ); |
---|
| 536 | error ( err_msg ); |
---|
| 537 | end |
---|
| 538 | |
---|
| 539 | mexnc ( 'close', ncid ); |
---|
| 540 | |
---|
| 541 | return |
---|
| 542 | |
---|
| 543 | |
---|
| 544 | |
---|
| 545 | |
---|
| 546 | |
---|
| 547 | |
---|