error getting unable to open file
Ältere Kommentare anzeigen
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 Kommentare
Viswajit Talluru
am 12 Dez. 2022
There appears to be a problem with the file. Please upload a sample CSV file by clicking the paperclip button.
Note that numbering variable names like that is a sign that you are doing something wrong. You should use indexing, just like the MATLAB documentation shows:
Viswajit Talluru
am 12 Dez. 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')
To import multiple files use the methods shown in the documentation:
Antworten (1)
VBBV
am 12 Dez. 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 Kommentare
VBBV
am 12 Dez. 2022
Save the CSV /Excel filenames that begin with characters, instead of numbers
Viswajit Talluru
am 12 Dez. 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
Kategorien
Mehr zu Stress and Strain finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!