Error in importData text
1 view (last 30 days)
Show older comments
The problem in importing my data, my M file where i loop on files and calculate mean, i get an error message saying
Error in Untitled2 at 10
mydata{k} = importdata(myfilename, ' ' );
Caused by:
Error using text scan
Unable to read any data from the file, text scan may not have read access.
and i checked and found mydata{k} is empty...i have no idea and i really need help to run this m file ?
the code is followed
close all
clear all
clc
numfiles = 10;
mydata = cell(1, numfiles);
values=[];
for k = 1:numfiles
myfilename = sprintf('tt%d.txt',k);
mydata{k} = importdata(myfilename, ' ' );
values{k} = mydata{k}(:,2);
m= mean(values{k});
fid=fopen('MeanOutputTT.txt','at');
fprintf(fid, '%f', m');
fprintf(fid, '\n');
fclose(fid);
end
2 Comments
xin wang
on 30 Dec 2022
Nice to meet you, I'd like to ask whether you have solved your question. I've a similiar code like yours. And I want to know how to solve this question like error in import data, thank you very much!
clc
clear all
close all
% Assignments
zdimension = input('Number of .tif images? ');
% Subvolume is the region in which 3D data will be cut around three-phase
% contact point
subvolume = input('Dimension of subvolume? ');
subvolume = subvolume/2;
mydata = cell(1, zdimension);
% Import .tif images in MATLAB
% !!If different number of figures, change %03d!!
for k = 1:zdimension
myfilename = sprintf('CPline%03d.tif', k);
mydata{k} = importdata(myfilename);
end
Answers (0)
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!