Borrar filtros
Borrar filtros

textread file not found error

8 visualizaciones (últimos 30 días)
Yusuf Baldan
Yusuf Baldan el 23 de Jun. de 2020
Comentada: Yusuf Baldan el 27 de Jun. de 2020
Hello, I am beginner at MATLAB and I am trying to plot a graph by some datas from a text file but I get this error message.
These are codes that i wrote;
clc;
clear;
[names,a,b,c,d]=textread('nums.txt','%s %d %d %d %d')
T=200:20:400
CpSO2=a(1)+b(1)*T+c(1)*T.^2+d(1)*T.^3;
CpSO3=a(2)+b(2)*T+c(2)*T.^2+d(2)*T.^3;
CpO2=a(3)+b(3)*T+c(3)*T.^2+d(3)*T.^3;
CpN2=a(4)+b(4)*T+c(4)*T.^2+d(4)*T.^3;
plot(T,CpSO2)
hold on
plot(T,CpSO3)
hold on
plot(T,O2)
hold on
plot(T,N2)
Thanks for your helps.

Respuestas (1)

Pulkit Goel
Pulkit Goel el 24 de Jun. de 2020
The issue maybe that your current directory of MATLAB file and the directory your 'nums.txt. files is saved are different. For this you need to specify complete path of yout file. For example:
[names,a,b,c,d]=textread('C:\Users\PULKIT\Desktop\nums.txt','%s %d %d %d %d')
In my case I saved the file on my desktop. You can see the exact path by right clicking on the file and going in Properties (in case you are using windows).
  7 comentarios
Image Analyst
Image Analyst el 27 de Jun. de 2020
So is it solved (no errors), or not???
Attach 'nums.txt' if you need more help. save() and load() are fine if you're just going to use MATLAB but if you want to look at them in a text editor or some other program you might want to still save them as a text file.
Yusuf Baldan
Yusuf Baldan el 27 de Jun. de 2020
I solved the question by another way, but i still get the error when i use textread. I attached the text file.

Iniciar sesión para comentar.

Categorías

Más información sobre Low-Level File I/O en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by