Error in importData text

1 view (last 30 days)
yasmin khattab
yasmin khattab on 17 Aug 2015
Commented: Mathieu NOE on 2 Jan 2023
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
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? ');
Unable to run the 'fevalJSON' function because it calls the 'input' function, which is not supported for this product offering.
% 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
Mathieu NOE
Mathieu NOE on 2 Jan 2023
hello
can you share the data file that created the issue ?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!