Analysis for GRACE data

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

Do these two folders exist on your hard disk?
'C:\my_data', 'C:\my_data\GRACE_tut'
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?
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
Alright Sir.. Thanks for your reply.. I am grateful

Sign in to comment.

Answers (1)

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 Comment

Alright.. This is perfect and it worked.. Thank you so much

Sign in to comment.

Categories

Asked:

on 19 Jun 2020

Commented:

on 19 Jun 2020

Community Treasure Hunt

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

Start Hunting!