Modify then write data in the given format
Ahora está siguiendo esta pregunta
- Verá actualizaciones en las notificaciones de contenido en seguimiento.
- Podrá recibir correos electrónicos, en función de las preferencias de comunicación que haya establecido.
Se ha producido un error
No se puede completar la acción debido a los cambios realizados en la página. Vuelva a cargar la página para ver el estado actualizado.
0 votos
Comparte un enlace a esta pregunta
1 comentario
Comparte un enlace a este comentario
Respuesta aceptada
0 votos
Comparte un enlace a esta respuesta
- Read the first three columns to one string, since they shall only be copied to the output file.
- Read the following six columns to a double array.
- Add 1 to the prescribed elements of the array
- Use the same format string to write the data (don't forget new-line)
27 comentarios
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
- It's possible to read your example with textscan and a similar format specifier - see my addendum. Or are we speaking past each other?
- Can we be sure that "undocumented" behavior of textscan doesn't change between releases?
- "Somewhere some months ago"   might be this thread read ascii non-delimited file.
- "older Fortran and are still around"   that's true and most large "csv-files" contains fixed-width columns. Long time ago reading fixed-format text-files was much faster than reading free-format. Is that still the case?
- Rows with leading spaces causes problems. '%s' handles it, but '%f' doesn't.
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
- Regarding the documentation in general I think that it's okay and is being improved over time. However, I've have wishes. More elaborated problem oriented examples, e.g. "How to read fixed width text file" and "How to read multi-section text files". Easier to find a function when I forgotten the name. And more.
- textscan   Knowledge on C might helps to understand why, but must not be required. (If needed that should be clearly stated.) Regarding 'Delimiter','' and 'Whitespace','' I still think they don't cause the promised behavior. Recently, I read some documentation on Fortran format specifiers. We only want a small subset.
- The documentation of the low-level HDF5-functions is another example of referring to third party documentation. In this case I think it is okay.
- The documentation on Regular expressions is okay I think. However, I think more elaborated examples would be useful.
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
- the first one (with commas) is the best (i.e. most readable) and
- that something like this would fit better in the Matlab environment than a syntax, which mimics fortrans FORMAT
Comparte un enlace a este comentario
Comparte un enlace a este comentario
- Sure, it's just "syntactic sugar".
- Maybe, a syntax like this would be enough (with a fortran engine)
- I don't understand TMW
Comparte un enlace a este comentario
Comparte un enlace a este comentario
- reading with textscan together with a format-string based entirely on %wc where w is a whole number
- format-string according to my comment above
- converting to numerical in a second step - maybe with str2num.
- do some timing experiments
- Is there a need for a new function to read fixed-formatted text files?
- Does my prototype handle the most frequent types of fixed-width files?
- A good fortran-mex-function, how much faster would that be?
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
- On input, the F data edit descriptor transfers w characters from an external field and assigns their real value to the corresponding I/O list item. The external field data must be an integer or real constant.
- If the input field contains only an exponent letter or decimal point, it is treated as a zero value.
- If the input field does not contain a decimal point or an exponent, it is treated as a real number of w digits, with d digits to the right of the decimal point. (Leading zeros are added, if necessary.)
- If the input field contains a decimal point, the location of that decimal point overrides the location specified by the F descriptor.
- If the field contains an exponent, that exponent is used to establish the magnitude of the value before it is assigned to the list element.
- An explicit 1X to skip the delimiter, or
- A compiler-dependent extension that recognizes the comma as a delimiter(*)
Comparte un enlace a este comentario
Comparte un enlace a este comentario
- Nobody would read them, and
- It would take a "language lawyer" to parse the result in the exotic cases if did.
Más respuestas (0)
Categorías
Más información sobre Sudoku en Centro de ayuda y File Exchange.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
