error getting unable to open file

3 visualizaciones (últimos 30 días)
Viswajit Talluru
Viswajit Talluru el 12 de Dic. de 2022
Editada: Stephen23 el 12 de Dic. de 2022
clear all
clc
forcedisp1 = readtable("2c.csv");
forcedisp2 = readtable("3c.csv");
forcedisp3 = readtable("5c.csv");
forcedisp4 = readtable("6c.csv");
og1 = 44.64;
d1 = 18.82;
area1 = (pi/4)*(d1^2);
og2 = 44.97;
d2 = 18.81;
area2 = (pi/4)*(d2^2);
og3 = 44.58;
d3 = 18.83;
area3 = (pi/4)*(d3^2);
og4 = 44.71;
d4 = 18.85;
area4 = (pi/4)*(d4^2);
forcedisp_mat1 = table2array(forcedisp1);
time1 = forcedisp_mat1(:,1);
displacement1 = forcedisp_mat1(:,2);
force1 = forcedisp_mat1(:,3);
forcedisp_mat2 = table2array(forcedisp2);
time2 = forcedisp_mat2(:,1);
displacement2 = forcedisp_mat2(:,2);
force2 = forcedisp_mat2(:,3);
forcedisp_mat3 = table2array(forcedisp3);
time3 = forcedisp_mat3(:,1);
displacement3 = forcedisp_mat3(:,2);
force3 = forcedisp_mat3(:,3);
forcedisp_mat4 = table2array(forcedisp4);
time4 = forcedisp_mat4(:,1);
displacement4 = forcedisp_mat4(:,2);
force4 = forcedisp_mat4(:,3);
stress1 = -force1./area1;
strain1 = displacement1./og1;
stress2 = -force2./area2;
strain2 = displacement2./og2;
stress3 = -force3./area3;
strain3 = displacement3./og3;
stress4 = -force4./area4;
strain4 = displacement4./og4;
figure(1)
plot(strain1,-stress1, "LineWidth", 1.5)
hold on
plot(strain2,-stress2, "LineWidth", 1.5)
hold on
plot(strain3,-stress3, "LineWidth", 1.5)
hold on
plot(strain4,-stress4, "LineWidth", 1.5)
xlabel('Strain')
ylabel('Stress MPa')
  4 comentarios
Viswajit Talluru
Viswajit Talluru el 12 de Dic. de 2022
file is attached
Stephen23
Stephen23 el 12 de Dic. de 2022
Editada: Stephen23 el 12 de Dic. de 2022
You used filename "2c.csv" in your question, but the file you uploaded is named "c2.csv". Different names.
The import works fine here:
M = readtable('c2.csv')
M = 42480×3 table
Time Displacement Force ____ ____________ _______ 0 0 -0.0812 0.02 0 -0.086 0.04 0.0003 -0.0434 0.06 0.0016 0.2524 0.08 0.004 0.8564 0.1 0.0065 1.4255 0.12 0.0088 1.9586 0.14 0.0117 2.589 0.16 0.0154 3.31 0.18 0.0196 4.0906 0.2 0.0236 4.811 0.22 0.0273 5.4391 0.24 0.0308 5.9655 0.26 0.0341 6.4445 0.28 0.0374 6.9111 0.3 0.0407 7.3844
To import multiple files use the methods shown in the documentation:

Iniciar sesión para comentar.

Respuestas (1)

VBBV
VBBV el 12 de Dic. de 2022
Begin the filenames with characters ,
forcedisp1 = readtable("c2.csv"); % use characters first
forcedisp2 = readtable("c3.csv");
forcedisp3 = readtable("c5.csv");
forcedisp4 = readtable("c6.csv");
  3 comentarios
Viswajit Talluru
Viswajit Talluru el 12 de Dic. de 2022
does not work shows the same error
VBBV
VBBV el 12 de Dic. de 2022
Editada: VBBV el 12 de Dic. de 2022
May be you might have entered the filename as 2c.csv while saving the file, but still using the xlsx extension. So, the filename actually becomes 2c.csv.xlsx instead of 2c.csv Check again. Save the filename as c2 while saving data and select the dropdown option below the filename and select *.csv

Iniciar sesión para comentar.

Categorías

Más información sobre Stress and Strain en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by