How do I get each iteration of a for loop into a single row matrix?
2 次查看(过去 30 天)
显示 更早的评论
Here I am getting each iteration correctly but I need pmf to be a row matrix with the answers from 0 to max(Data).
function [pmf] = CalcRelFreq(Data);
for range = 0:max(Data)
pmf = [1 ;sum(Data == range)/length(Data)]
end
2 个评论
James Tursa
2025-4-24
编辑:James Tursa
2025-4-24
What is size(Data)? Please provide a small example input and desired output. pmf looks like a column vector, so it is unclear how you want these stacked into a row vector.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Continuous Wavelet Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!