# How to multiply 8*8 data sets elementwise?

2 vues (au cours des 30 derniers jours)
vimal kumar chawda le 24 Mai 2021
I want multiply with 1.02 each and every element so new table will be 8*8. How one can use for loop?
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponse acceptée

David Fletcher le 24 Mai 2021
If you're just multiplying by the scaler of 1.02 then
Qxxepoch1{:,:}*1.02
will do what you want without a loop
##### 5 commentairesAfficher 3 commentaires plus anciensMasquer 3 commentaires plus anciens
David Fletcher le 24 Mai 2021
Just to expand on the information above - your original data was stored in a table. You can't apply the times (*) operator directly on the table, so writing
Qxxepoch1{:,:}
extracts all the data in the table into a matrix. Holding the data in a matrix allows you to apply the times operator to multiply the elements by 1.02. However, as mentioned above, to access the data in a matrix you use the normal indexing with parenthesis () - using brace {} indexing on a matrix will cause the error you experienced. It can be confusing - you just need to be aware of what your data is stored in, and use the appropriate indexing for the task.
vimal kumar chawda le 28 Mai 2021
Thank you , it was beneficial .

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

R2021a

### Community Treasure Hunt

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

Start Hunting!

Translated by