How to output function results over split columns
Mostrar comentarios más antiguos
I have a loop which contains a function that produces results to a different sheet of a matrix. I would like to insert an additional column of information after the function has been completed, but I am not sure how to index the function output to allow for this. Ideally, I would like to collect the output information into a split set of columns so my inserted column is in the middle, but I either receive a 'Subscripted assignment dimension mismatch' or 'Undefined function or variable 'output'' error (depending on if I initialize with a blank array or not).
for i = 1:N;
output(:,[1:4,6:end],i+1) = processFiles(input);
output(:,5,i+1) = output(:,4,i+1)./output(:,2,i+1);
end
Does anybody have a suggestion on how to go about doing this type of insertion?
(Before you ask, no, I cannot provide a sample of 'input' or the 'processFiles' function)
Thanks
3 comentarios
TADA
el 24 de En. de 2019
Set The Output Of processFiles Into A Matrix Regularly, Then Concat All Three Parts Of The Data Into Your Output Matrix
Bob Thompson
el 24 de En. de 2019
TADA
el 24 de En. de 2019
I'm Not Sure If It's Possible Or Not, I Never Tried This Type Of Indexing. But I Beg To Differ About "Simplicity's Sake".
The Complex Indexing Seems Less Clear Than Doing It With The Intermediate
Think About The Next Person Reading Your Code, or Yourself Reading It A Year From Today.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!