Using variables from .mat structures.

2 ビュー (過去 30 日間)
Ruslan Askarov
Ruslan Askarov 2023 年 6 月 1 日
編集済み: Stephen23 2023 年 6 月 5 日
there are given 2 channel matrices, namely,
channel_1.mat and channel_2.mat which contain the struct data.
I need to use variables from this struct in folowing function:
But I don't know how I can implement this
%Import channel information
%Full correlation matrices estimation
for i=nF:Nt
function Rh = f(Nt,nT,nF)
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
  4 件のコメント
Stephen23 2023 年 6 月 5 日
編集済み: Stephen23 2023 年 6 月 5 日
"with H' I meant hermitian transpose, maybe there is another operator."
That is the correct operator, it is just the location is wrong. Perhaps you intended this:
% ^


回答 (1 件)

Sanjana 2023 年 6 月 5 日
The error message you encountered is due to attempting to access the transpose of the matrix H through parentheses directly. In MATLAB, the parentheses “()” operator has higher precedence than the transpose operator “'” according to the Operator Precedence Rules. Therefore, the expression “data.H'(:,:,nT,nF)” is interpreted as applying the parentheses to the transpose operator itself, rather than to the transposed matrix “ data.H'” resulting in an error.
To resolve this issue, it is recommended to assign the transposed matrix to a new variable before accessing its columns. By doing so, you explicitly indicate the desired order of operations.
Please, refer to the following link to know more about operator precedence rules,
For further clarification on accessing variables stored in a .mat file and accessing variables stored in a structure array, you can refer to the following links:
Hope this helps!


Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索




Community Treasure Hunt

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

Start Hunting!

Translated by