フィルターのクリア

Translating From IDL to Matlab

6 ビュー (過去 30 日間)
Joseph Pate
Joseph Pate 2021 年 11 月 29 日
回答済み: Rishav 2024 年 4 月 8 日
Hi! I have been working on a document where I am translating lines of IDL code into Matlab. There are a few lines that I have been stuck on and I would super appreicate some help with. They are as follows in IDL:
rad = double(swap_endian(( assoc(1,intarr(5760,2880)) )[0])) + 3396000.d0
dci = ( assoc(1,fltarr(5760,2880)) )[0]
Both lines deal with the assoc function which I cannot find a good substitute for in Matlab. Thanks so much!

回答 (1 件)

Rishav
Rishav 2024 年 4 月 8 日
Hi Joseph,
Please refer to the MATLAB converted code below:
%First line
array = zeros(5760, 2880, 'int32');
%Convert the first element to double, swap its bytes and then add 3396000.0
value = double(swapbytes(array(1))) + 3396000.0;
%Second line
array = zeros(5760, 2880);
%Access the first element
dci = array(1);
Please refer to the below mentioned documentations for more information on:
  1. swapbytes - https://www.mathworks.com/help/matlab/ref/swapbytes.html
  2. zeros - https://www.mathworks.com/help/matlab/ref/zeros.html

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by