I am having trouble understanding this error “To assign to or create a variable in a table, the number of rows must match the height of the table.”, can someone explain?
As stated in the title, I’m struggling with getting rid of error message "To assign to or create a variable in a table, the number of rows must match the height of the table."
Here is a snippit of my original code. The line specifically causing hte probled is the line within the For loop. Sorry if this is a simple question, I do not usually work MATLAB and got thrown into this project. Thank you!
units_tbl(1,:)
values_tbl_new = vertcat(units_tbl(1,:),values_tbl);
for k = 1:length(vars_wanted)
values_tbl_new.(vars_wanted(k)) = values_tbl.(vars_wanted(k));
endAs stated in the title, I’m struggling with getting rid of error message "To assign to or create a variable in a table, the number of rows must match the height of the table."
Here is a snippit of my original code. The line specifically causing hte probled is the line within the For loop. Sorry if this is a simple question, I do not usually work MATLAB and got thrown into this project. Thank you!
units_tbl(1,:)
values_tbl_new = vertcat(units_tbl(1,:),values_tbl);
for k = 1:length(vars_wanted)
values_tbl_new.(vars_wanted(k)) = values_tbl.(vars_wanted(k));
end As stated in the title, I’m struggling with getting rid of error message "To assign to or create a variable in a table, the number of rows must match the height of the table."
Here is a snippit of my original code. The line specifically causing hte probled is the line within the For loop. Sorry if this is a simple question, I do not usually work MATLAB and got thrown into this project. Thank you!
units_tbl(1,:)
values_tbl_new = vertcat(units_tbl(1,:),values_tbl);
for k = 1:length(vars_wanted)
values_tbl_new.(vars_wanted(k)) = values_tbl.(vars_wanted(k));
end matlab MATLAB Answers — New Questions