Please how do i define my directories. This is a snippet of a code i am trying to run but it returns error each time i try to run it.. Please help !!!
My Error Message
Warning: Name is nonexistent or not a directory: C:\my_data
> In path at 110
In addpath at 87
In Coastal_West_Africa at 5
Warning: Name is nonexistent or not a directory: C:\my_data\GRACE_tut
> In path at 110
In addpath at 87
In Coastal_West_Africa at 6
The code
clc
clear all
close all
%% add paths- define the directory to your folders
addpath('C:\my_data');
addpath('C:\my_data\GRACE_tut');
%% Importing the Shapefiles
M = m_shaperead('continent_polygon');
M1=m_shaperead('South_America_boundary');
M2=m_shaperead('South_America');
M3=m_shaperead('Amazon');
%% Load data
load 'South_America_GRACE_Mascon_2002_2017.mat';
%% Extracting South America
Lat=Lat(:,1); Lon=Lon(1,:);Lon=Lon';
SAlat1=find(Lat<=16&Lat>=-56);
SAlon1=find(Lon<=-32& Lon>=-88);
SA_lat=Lat(SAlat1);
SA_lon=Lon(SAlon1);

댓글 수: 4

Do these two folders exist on your hard disk?
'C:\my_data', 'C:\my_data\GRACE_tut'
Ikechukwu Kalu
Ikechukwu Kalu 2020년 6월 19일
No sir.. They dont..
I received the code from my friend like that but he is so busy and i cant even ask him about it.
Please what do i do?
per isakson
per isakson 2020년 6월 19일
Wait until your friend is talkable.
I cannot guess
  • what's in South_America_GRACE_Mascon_2002_2017.mat or
  • how the function m_shaperead works
Ikechukwu Kalu
Ikechukwu Kalu 2020년 6월 19일
Alright Sir.. Thanks for your reply.. I am grateful

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

답변 (1개)

Aayush Shah
Aayush Shah 2020년 6월 19일

0 개 추천

Hi Ikechukwu,
My understanding of your question is that you receive an error "Warning: Name is nonexistent or not a directory: C:\my_data" while accessing the data files of your project. The reason for this is that you're trying to access the file from a location where it doesn't exist. So to solve your issue, change the address present in the addpath function to the address where your project files are stored. If you want to get the address of the file, right-click on the project file and copy the location present there(assuming you're a windows user). Then you won't be getting the error.
For example, suppose your file is present in the downloads folder, then change the code to:
addpath('C:\Users\(yourusername)\Downloads\(yourfilename)');
This would solve your issue.

댓글 수: 1

Ikechukwu Kalu
Ikechukwu Kalu 2020년 6월 19일
Alright.. This is perfect and it worked.. Thank you so much

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

카테고리

도움말 센터File Exchange에서 Search Path에 대해 자세히 알아보기

질문:

2020년 6월 19일

댓글:

2020년 6월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by