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.
manipulate matrix dimension (ignoring lines)
Respuesta aceptada
26 comentarios
- I'm surprised you didn't get an 'Unexpected MATLAB expression' error when you defined nnew. A leading single quote does NOT create a string (char vector) like it does in Excel.
- The load command cannot be used to load text data files. Star's suggestion to use textscan is a good one.
- I suggest eliminating nnew entirely and changing your loop to for i=1:4. Then create the filename similarly to your strcat command (the part inside your load) but replacing nnew(i,:) with num2str(i). Actually, if I were doing it, I would use sprintf, but strcat should work. For example: filename = strcat(...
- Then, use Star's suggestion and use fopen and textscan (with an appropriate format spec) to read the files. Since you are doing this in a loop - reading multiple files - you will want to save the data for each file separately (I suggest using a cell array so replace data = ... with data{i} = ... in your loop). Or, you could put your plot command inside the loop (and use hold on) so you get each set of data on the same plot.
- Be sure to fclose your file at the bottom of the loop.
- Number one suggestion: read the documentation for all of the commands that Star and I have suggested. There are examples in there that will really help you understand how things are working. Also, read the documentation on using the debugger. You can step through your code and see where things are going wrong.
Más respuestas (0)
Ver también
Categorías
Etiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!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.
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)
Asia-Pacífico
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
