If you have a data set in Matlab and want to correct certain values, you can use logical indexing to select the entries that you want to change and replace them with the new values.
For example, let's say you have a vector of spring coefficients k
:
main.m22 chars2 lines
Suppose you notice that the third value should actually be 35. You can correct this by doing:
main.m17 chars2 lines
This will find all entries in k
that are equal to 30 and replace them with 35. Now k
will be:
main.m22 chars2 lines
To display all the values in a table format, you can create a table from your data using the table
function and display it using the disp
function.
For example:
main.m147 chars5 lines
This will create a table t
with the data in data
, with variable names Var1
, Var2
, and Var3
, and display it in the command window. You can replace data(:,1)
, data(:,2)
, and data(:,3)
with your own data vectors or matrices.
gistlibby LogSnag