diff -r 0976f9fccbbd scripts/io/strread.m
--- a/scripts/io/strread.m	Thu Aug 21 16:05:09 2014 -0700
+++ b/scripts/io/strread.m	Fri Aug 22 22:14:03 2014 +0200
@@ -54,6 +54,10 @@
 ## optional width can be specified as %Ns, etc. where N is an integer > 1.
 ## For %f, format specifiers like %N.Mf are allowed.
 ##
+## For %f, %u, and %d specifiers, a bit width can be specified and the
+## relating read numbers will be casted to that bit width: %f32 to single,
+## %f64 to double, %d8, %d16, %d32 and %d64 to int8, int16, int32, and int64,
+## respectively; same for %u8 ... %u64 (uint8 ... uint64).
 ## @item literals
 ## In addition the format may contain literal character strings; these will be
 ## skipped during reading.
@@ -302,16 +306,17 @@
     ## like %f<literal>) (w/o delimiter in between) are fixed further on
     format = strrep (format, "%", " %");
     fmt_words = regexp (format, '[^ ]+', "match");
-    
+
     ## Find position of conversion specifiers (they start with %)
     idy2 = find (! cellfun ("isempty", regexp (fmt_words, '^%')));
 
     ## Check for unsupported format specifiers
-    errpat = '(\[.*\]|[cq]|[nfdu]8|[nfdu]16|[nfdu]32|[nfdu]64)';
+    errpat = '(\[.*\]|[cq])';
     if (! all (cellfun ("isempty", regexp (fmt_words(idy2), errpat))))
-      error ("strread: %q, %c, %[] or bit width format specifiers are not supported yet.");
+      error ("strread: %q, %c and %[] format specifiers are not supported yet.");
     endif
 
+    allwptrn = '([nfdu]8|[nfdu]16|[nfdu]32|[nfdu]64)';
     ## Format conversion specifiers following literals w/o space/delim
     ## in between are separate now.  Separate those w trailing literals
     a = strfind (fmt_words(idy2), "%");
@@ -319,6 +324,11 @@
     for jj = 1:numel (a)
       ## From right to left to avoid losing track
       ii = numel (a) - jj + 1;
+      [re] = regexp (fmt_words{idy2(ii)}, allwptrn, "end");
+      if (!isempty (re))
+        ## Add bit width specifier to conv. specifier
+        b{ii}(1) = re;
+      endif
       ## Check for illegal format specifiers
       if (isempty (b{ii}))
         error ("strread: unknown format specifier #%d ('%s')\n",
@@ -452,6 +462,7 @@
   ## Replace TreatAsEmpty char sequences by empty strings
   if (! isempty (empty_str))
     for ii = 1:numel (empty_str)
+      ## "words" matching empty_str may still be bordered by literals
       idz = strncmp (empty_str{ii}, words, length (empty_str{ii}));
       words(idz) = {""};
     endfor
@@ -706,7 +717,26 @@
           if (! isempty (regexp (fmt_words{m}, "%[du]")))
             ## Cast to integer
             ## FIXME: NaNs will be transformed into zeros
-            data = int32 (data);
+            switch fmt_words{m}
+              case '%d8'
+                data = int8 (data);
+              case '%d16'
+                  data = int16 (data);
+              case '%d64'
+                  data = int64 (data);
+              case '%u8'
+                data = uint8 (data);
+              case '%u16'
+                  data = uint16 (data);
+              case {'%u32', '%u'}
+                  data = uint32 (data);
+              case '%u64'
+                  data = uint64 (data);
+              otherwise
+                data = int32 (data);
+            endswitch
+          elseif (regexp (fmt_words{m}, '%f32'))
+            data = single (data);
           endif
           data(n) = numeric_fill_value;
           if (pad_out)
@@ -725,18 +755,49 @@
               ### FIXME: Erroneously formatted data lead to NaN, not an error
               ###        => ReturnOnError can't be implemented for numeric data
               data = str2double (strtrunc (data, swidth));
-              data(n) = numeric_fill_value;
+              if (! isempty (regexp (fmt_words{m}, "f32")))
+                data = single (data);
+              endif
               if (pad_out)
                 data(end+1:num_lines) = numeric_fill_value;
               endif
-              if (numel (nfmt) > 1)
-                sprec = str2double (nfmt{2});
-                data = 10^-sprec * round (10^sprec * data);
-              elseif (! isempty (regexp (fmt_words{m}, "[du]")))
+              if (! isempty (regexp (fmt_words{m}, "[du]")))
                 ## Cast to integer
                 ## FIXME: NaNs will be transformed into zeros
-                data = int32 (data);
+                s = regexp (fmt_words{m}, "[du]", "start");
+                switch fmt_words{m}(s : end)
+                  case "d8"
+                    data = int8 (data);
+                  case "d16"
+                    data = int16 (data);
+                  case "d64"
+                    data = int64 (data);
+                  case "u8"
+                    data = uint8 (data);
+                  case "u16"
+                    data = uint16 (data);
+                  case {"u32", "u"}
+                    data = uint32 (data);
+                  case "u64"
+                    data = uint64 (data);
+                  otherwise
+                    data = int32 (data);
+                endswitch
+              else
+                if (! isempty (strfind (fmt_words{m}, "f32")))
+                  data = single (data);
+                  if (numel (nfmt) > 1)
+                    sprec = str2double (nfmt{2});
+                    data = 10^-sprec * single (round (10^sprec * data));
+                  endif
+                else
+                  if (numel (nfmt) > 1)
+                    sprec = str2double (nfmt{2});
+                    data = 10^-sprec * double (round (10^sprec * data));
+                  endif
+                endif
               endif
+              data(n) = numeric_fill_value;
               varargout{k} = data.';
               k++;
             case "s"
@@ -1025,12 +1086,6 @@
 %!error <format specifiers are not supported> strread ("a", "%*[a] %d")
 %!error <format specifiers are not supported> strread ("a", "%[^a]")
 %!error <format specifiers are not supported> strread ("a", "%*[^a] %d")
-%!error <format specifiers are not supported> strread ("a", "%d8")
-%!error <format specifiers are not supported> strread ("a", "%*d8 %s")
-%!error <format specifiers are not supported> strread ("a", "%f64")
-%!error <format specifiers are not supported> strread ("a", "%*f64 %s")
-%!error <format specifiers are not supported> strread ("a", "%u32")
-%!error <format specifiers are not supported> strread ("a", "%*u32 %d")
 
 %% Illegal format specifiers
 %!test
