Reshape matrix adding columns of zeros at specific index
Mostrar comentarios más antiguos
Hello,
I am a beginner in Matlab and right I am a bit stack in a part of my code. The code import a baseline txt. file data that contain variables from combustion engine. The baseline has A=4x178 first row name of variables and the other three numbers.
The thing is that after a time (project duration) the number of variables is increased (new variables are added) and now I have a txt files composed by B=4X204 with 26 new variables.
Without enter in detail the script to export the txt. file in the right format, what I have got is a vector of index of which new variables in B are not in A.
Now, what I am try to do is reshape A to be the same size than B but with zeros columns at the specific index.
I would be really grateful whether somenone could point me out in the right direction.
Thank you very much in advanced.
if Start_comparison==0
if columns_baseline<columns_logs
index_new=~ismember(Variables_Logs,Variables_Baseline);
Numeric_index=find(double(index_new));
end
end
1 comentario
What are A and B, tables? cell arrays? something else? They can't be matrices.
Does Variables_Logs correspond to B and Variables_Baseline correspond to A? What are the actual variable names for A and B.
Note that in your code, the conversion to double (in the find) is completely unnecesarry. It would work just as well an faster if you leave index_new as a logical array. The find is probably unnecessary as well.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Import and Export 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!