How to retrieve data from a Excel sheet saved at a particular location in pc?

조회 수: 1 (최근 30일)
Hello,
I want to retrieve data from an excel sheet stored at a particular location in the pc, the path of that particular file is provided in the code as below. However, the code is unable to read the file from the given location. I tried the matlab command importdata as well as readmatrix.
sigma_diff=0.5;
beta=0.01;
gamma_nonlin=2*beta;
i=100;
j=1;
speed_F=zeros(i,j);
for j=1:100
mu(i,j)=importdata('D:\Rahul\Data_tokamak\data&plot\data1_non-ctrw\L-mode data from L-mode eqn\data without edge source\Fisher model\data1_L0_sig0.5_f1\a5_term(i,j)');
speed_F(i,j)=sqrt(sigma_diff*data1.variable.turbulence(i,j)*mu(i,j)^2)/(2*gamma_nonlin);
end
Error using importdata
Unable to open file.

채택된 답변

Chunru
Chunru 2023년 11월 22일
이동: Dyuman Joshi 2023년 11월 22일
You need to provide the extension name (.xlsx ?) to the file.
  댓글 수: 8
Rahul
Rahul 2023년 11월 26일
편집: Rahul 2023년 11월 26일
Hi,
I again have one error which shows
Index in position 1 exceeds array bounds. Index must not exceed 1.
Would help if someone please advise the correction for error I made in the code.
sigma_diff=0.5;
beta=0.01;
gamma_nonlin=2*beta;
i=100;
j=1;
t=linspace(0,10,100);
speed_F=zeros(i,j);
source=load('D:\Rahul\Data_tokamak\data&plot\data1_non-ctrw\L-mode data from L-mode eqn\data without edge source\Fisher model\data7_L0_sig5.0_f1.mat');
mu_lmode=source.data.variable.a5_term(100,:);
turb=source.data.variable.turbulence(100,:);
for j=1:100
speed_F=real(sqrt(sigma_diff*turb(i,j).^(1-beta).*mu_lmode(i,j)/(2*gamma_nonlin)));
end
with regards,
rc

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by