Problem using cd in MATLAB function
Ältere Kommentare anzeigen
Hi, I'm writing a MATLAB function that needs to change directories, but I keep getting this error:
Error in GetStations (line 5)
home = cd;
Here is part of my function:
function [Stations,NumStations] = GetStations(NLat,SLat,ELon,WLon)
% This function searches a list of seismic stations for those within the geographic box specified by the input latitudes and longitudes.
home = cd; % Where I'm currently working
% Go to where the seismic station list is saved:
cd('C:\Users\User\Desktop\Research\MATLABFunctions');
StationList = fopen('Stations.txt'); % Open text file
% Read file, skip first line:
AllStations = textscan(StationList, '%s %s %f %f','headerlines', 1);
fclose(StationList); % Close text file
cd(home); % Go back to where I'm currently working
1 Kommentar
Walter Roberson
am 27 Jul. 2015
Please show the complete error message.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Geographic Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!