Analysis for GRACE data
    4 views (last 30 days)
  
       Show older comments
    
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 Comments
  per isakson
      
      
 on 19 Jun 2020
				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
Answers (1)
  Aayush Shah
    
 on 19 Jun 2020
        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.
See Also
Categories
				Find more on Search Path 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!

