Keep getting Parse error here
Mostrar comentarios más antiguos
%loads Bathyfile downloaded from Canvas
load Bathyfile.mat
%loads Salt file downloaded from Canvas
load salt.txt
%Creates Substructure for depth/long/sal data from Salt file
sal.depth=(S(2:34,1));
sal.longitude=(S(1,2:42));
sal.salinity=(S(2:34,2:42));
%Contours plot
contourf(sal.longitude,sal.depth,sal.salinity,[31.5:.1:35]);
%Creates Substructure for depth/height/long/lat data from Bathyfile file
bath.fiftyfive=bath.lat(151);
bath.fiftyone=bath.lat(256);
bath.fortyeight=bath.lat(361);
height.fifty_five=bath.height(151,:);
height.fifty_one=bath.height(256,:);
height.forty_eight=bath.height(361,:);
%Plots data, including superimpositions
hold on;
plot(bath.longitude,bath.height(151,:));
plot(bath.longitude,bath.height(256:));
plot(bath.longitude,bath.height(361,:));
%Labelling graphs
xlabel('Longitude')
ylabel('Latitude')
title('Bathymetry_vs_Longitude')
%loads Bathyfile downloaded from Canvas
load Bathyfile.mat
%loads Salt file downloaded from Canvas
load salt.txt
%Creates Substructure for depth/long/sal data from Salt file
sal.depth=(S(2:34,1));
sal.longitude=(S(1,2:42));
sal.salinity=(S(2:34,2:42));
%Contours plot
contourf(sal.longitude,sal.depth,sal.salinity,[31.5:.1:35]);
%Creates Substructure for depth/height/long/lat data from Bathyfile file
bath.fiftyfive=bath.lat(151);
bath.fiftyone=bath.lat(256);
bath.fortyeight=bath.lat(361);
height.fifty_five=bath.height(151,:);
height.fifty_one=bath.height(256,:);
height.forty_eight=bath.height(361,:);
%Plots data, including superimpositions
hold on;
plot(bath.longitude,bath.height(151,:));
plot(bath.longitude,bath.height ((256:));
plot(bath.longitude,bath.height(361,:));
%Labelling graphs
xlabel('Longitude')
ylabel('Latitude')
title('Bathymetry_vs_Longitude')
Respuestas (1)
Steven Lord
el 20 de Sept. de 2019
There are two parse errors in that code, both where you've forgotten a comma between indices 256 and the colon character.
plot(bath.longitude,bath.height(256:));
% and later
plot(bath.longitude,bath.height ((256:));
In the future, look for the red underlines in the right gutter when you've opened your code in the MATLAB Editor. These indicate where you've written something MATLAB can't understand that will prevent your code from running. Orange underlines are places where the Code Analyzer in MATLAB indicates there may be something you can do to improve your code. In both cases, there should be an underlined part of that line of code and hovering over it will indicate what MATLAB believes is wrong.
Categorías
Más información sobre Downloads en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!