What am I missing on the round function
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Maroulator
el 21 de Dic. de 2014
Respondida: Image Analyst
el 21 de Dic. de 2014
I have the following code; Round_Data2 gives me the desired output, whereas Round_Data1 does not and I need to know why this is the case. The objective of the code is to round the values of filename to the the nearest integer. filename is a text file, labelled "Input Data," ie "Input Data.txt"
Any help would be extremely appreciated.
filename=inputdlg('Enter the name of the file you wish to read; include the file extension.');
filename=cell2mat(filename);
load(filename);
Round_Data1=round(filename); %Rounding
Round_Data2=round(Input_Data); %Rounding
0 comentarios
Respuesta aceptada
Image Analyst
el 21 de Dic. de 2014
You can't round a string. You need to read in the data and round that
storedStructure = load(filename);
thisData = storedStructure.yourData; % Whatever it's called...
thisData = round(thisData, 2); % Round to 2 decimal places.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Large Files and Big Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!