I have a row vector of dimension 1x300 and want to set its elements to zero without changing its dimension. I am trying to implement it using the example X = zeros(1,3,'uint32') provided in the documentation on zeros in mathworks.
Ältere Kommentare anzeigen
Setting the row vector to zero is changing its dimension.
The example in the documentation X = zeros(1,3,'uint32') is giving the following error, 'Index in position 3 exceeds array bounds (must not exceed 1).'
How can it be solved?
Akzeptierte Antwort
Weitere Antworten (1)
Subhadeep Koley
am 8 Nov. 2020
% Define a random vector 'X' for example
X = rand(1, 300);
% Set all elements of 'X' to zero
X = zeros(size(X), 'uint32');
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!