Borrar filtros
Borrar filtros

Storing Data in Zero Vectors

4 visualizaciones (últimos 30 días)
Chameleon17
Chameleon17 el 25 de Ag. de 2015
Respondida: dpb el 25 de Ag. de 2015
Good Evening, I have a very simple question which I have been struggling with.
LocationSquares = zeros (1:500)
out5 = Columns 1 through 7
35 36 38 46 48 49 50
735804 735788 735787 735816 735770 735788 735774
for Area = 1:500
if out5(1,i) == Area
Date = out5(2,i)
if out5(1,i) ~= Area
DateofOB = 0
end
end
end
LocationSquare(Area) = DateofOB
My out5 length varies for each year, not each location point has data for each year. I would like to store the date in the zero space of the corresponding Location Square, so 35 in the #35 zero space etc. Right now it's all a bit of a mess and I seem to be storing dates in each LocationSquare, but it isn't right there is a lot of repetition that shouldn't be occurring.
Any advice would be greatly appreciated.
  1 comentario
dpb
dpb el 25 de Ag. de 2015
LocationSquares = zeros (1:500);
will create a 500-D array of dimensions
size(LocationSquares)=[1,2,3,...,500];
This is highly unlikely what you intend; perhaps
LocationSquares = zeros(1,500);
maybe?

Iniciar sesión para comentar.

Respuestas (1)

dpb
dpb el 25 de Ag. de 2015
Aren't you just looking for
LocationSquare(out5(1,:)) = out5(2,:);

Categorías

Más información sobre Programming 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!

Translated by