Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

How to add with a Matrix

2 visualizzazioni (ultimi 30 giorni)
John Woods
John Woods il 19 Giu 2020
Chiuso: MATLAB Answer Bot il 20 Ago 2021
I have a 1x276 matrix that I want to add 1 to each element but each time I do, my matrix turns to all ones. So for example lets say A=[32 45 96] and I want to make it B=[33 46 97] how do I do that?

Risposte (1)

Walter Roberson
Walter Roberson il 19 Giu 2020
Modificato: Walter Roberson il 19 Giu 2020
B = A + 1
or
B = A;
for idx = 1 : numel(B)
B(idx) = B(idx) + 1;
end

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by