Borrar filtros
Borrar filtros

The title of a plot containing the data's file name.

13 visualizaciones (últimos 30 días)
William Harris
William Harris el 2 de Abr. de 2020
Respondida: Peng Li el 2 de Abr. de 2020
I have a program that allows the user to select a set of data in a txt file. This data is then plotted. I was wondering as to how I can get the name of the data file to appear in the title of that plot.
[filename]=uigetfile('*.txt')
%Loading the data the user has selected.
Data=load(filename);
%read file and make 3 colunm vectors
Easting_Data=Data(:,1);
Northing_Data=Data(:,2);
Depth_Data=Data(:,3);
%plotting the original unfiltered data for the user to view.
plot3(Easting_Data,Northing_Data,Depth_Data,'.')
view(2)
%HOW CAN I GET FILENAME TO APPEAR BELOW AFTER THE STATEMENT
title('UTM Position of the data in file')

Respuesta aceptada

Peng Li
Peng Li el 2 de Abr. de 2020
You have filename already when you load the data. Just need to combine this with the char array you have. Try
title(['UTM Position of the data in file ' filename]);

Más respuestas (0)

Categorías

Más información sobre Labels and Annotations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by