採用された回答

David Fletcher
David Fletcher 2021 年 5 月 24 日

0 投票

If you're just multiplying by the scaler of 1.02 then
Qxxepoch1{:,:}*1.02
will do what you want without a loop

5 件のコメント

vimal kumar chawda
vimal kumar chawda 2021 年 5 月 24 日
Thanks it works.
vimal kumar chawda
vimal kumar chawda 2021 年 5 月 24 日
Why it is showing that brace indexing is not supported for variables of this type. ?
Can you please help me with it?
Steven Lord
Steven Lord 2021 年 5 月 24 日
Use {} if your data is inside a cell array to reach into the cell to extract the data (like cracking an eggshell to reach the egg inside.) Use () if your data is in a matrix to extract individual elements (like picking an M&M from a bowl of candy.)
M = [1 2 3; 4 5 6; 7 8 9];
C = {M};
2*M(3, 1) % 2*7 = 14
ans = 14
2*C{1} % 2 times the matrix M
ans = 3×3
2 4 6 8 10 12 14 16 18
% 2 times the element in location (3, 1) in the matrix stored in the first cell of C
2*C{1}(3, 1)
ans = 14
David Fletcher
David Fletcher 2021 年 5 月 24 日
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
vimal kumar chawda 2021 年 5 月 28 日
Thank you , it was beneficial .

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索

製品

リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by