- put a pause after the xlsread(); or
- instead of using xlsread() look in the file exchange for xlsread1(); or
- switch to readtable() instead of xlsread(). Note that if you switch to readtable() then you can probably use it or readmatrix() instead of the csvread().
How to get rid of The RPC server is unavailable Error?
13 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I have a main folder with 10 subfolders in it. Each subfolder has 200 subfolders within them. in each of these 200 subfolders, I have 4 .csv files. I created a loop that the code opens a subfolder, do what I want and then move to the next one as follows
D = 'C:\Users\....\Data\'
S1 = dir(fullfile(D,'*'));
N1 = setdiff({S1([S1.isdir]).name},{'.','..'});
A = {};
B = {};
C = {};
for kk = 1 : 10
kk
D1 = fullfile(D, N1{kk});
S2 = dir(fullfile(D1,'*'));
N2 = setdiff({S2([S2.isdir]).name},{'.','..'});
for ii = 1 : 200
ii
T1 = dir(fullfile(D1,N2{ii},'*'));
C = {T1(~[T1.isdir]).name};
for jj = 1 : numel(C)
if jj == 1
F = fullfile(D1,N2{ii},C{jj});
[n,~,~] = xlsread(F);
elseif jj == 2
F = fullfile(D1,N2{ii},C{jj});
m = csvread(F);
elseif jj == 3
F = fullfile(D1,N2{ii},C{jj});
p = csvread(F);
elseif jj == 4
F = fullfile(D1,N2{ii},C{jj});
q = csvread(F);
end
end
A{kk, ii} = complex(p, m);
B{kk, ii} = q(:,1) - q(1,1);
C{kk, ii} = n(2);
end
end
when I run the code, I've got the "RPC server is unavailable" error on kk=2, ii =21. However, when I check the code manualy for kk=2, ii =21 it works perfectly. Any idea how I can get rid of this error? How I can improve the code to run faster? Any input would be greatly appreciated.
0 个评论
采纳的回答
Walter Roberson
2020-7-10
I can think of three potential solutions:
That is, I suspect that the connection to the excel server is not ready in time, so you either need to slow down access or use the excel server differently or avoid using the excel server.
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!