Why am I getting an error of subscripted assignment dimension mismatch
9 个评论
采纳的回答
8 个评论
So does that mean that when prompted to select a row, you want to be able to select a row? Your original code certainly did not work like that.
If that is the case, it's easy to change in part. First allow selection of multiple rows by changing the 'SelectionMode' to 'multiple':
%get row selection [selectedrow, ok] = listdlg('ListString', compose('%f', elementdata(:, 1)), 'PromptString', 'Select wavelength(s)', 'SelectionMode', 'multiple'); if ~ok, return; end %terminate if user click cancel
The rest of the code after that will work even if selectedrow is a vector (which will happen when you select multiple wavelengths).
As it is, the plot will have a line for each wavelength selected.
For your combined plot, you can't just sum the rows of Peak because the columns of each row correspond to different wavelengths. You first have to resample each row to the same wavelengths (with interp1 for example) before you can sum them. I don't have the time now to write that code for you.
更多回答(1 个)
0 个评论
另请参阅
类别
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!