I need help with shifting the values
古いコメントを表示
function sampleReadings = ShiftValues(sampleReadings)
% sampleReadings: Array containing 3 elements
% Write three statements to shift the sampleReadings array contents 1 position to the left
% Note: The rightmost element should be -1
sampleReadings = ShiftValues(1:3)
end
採用された回答
その他の回答 (1 件)
Joshua Olatunji
2021 年 2 月 23 日
3 投票
A more general way for any array is:
% Write a statement to shift the array contents 1 position to the left
sampleReadings = sampleReadings([2:end]);
% Assign the rightmost element with -1
sampleReadings = [sampleReadings(1:end),-1]
1 件のコメント
saphir alexandre
2022 年 1 月 30 日
thank you so much i was really struggling to understand this question
カテゴリ
ヘルプ センター および File Exchange で Polar Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!