How to concatenate data from two different functions in MATLAB?
Mostra commenti meno recenti
Part of one function has this:
%% Concatenating Time & Point to Point Angles. Time will be the first column
ConcPTP1 = [TimeP2P1,P2PAng1]; %% getting the datat from here works
Part of the other function has this:
%% Concatenating Time & Angles. Time will be the first column
ConcLin1 = [TimeLin1,AnglesLin1]; %% getting the datat from here works too
Part of the main program has this
%% Collecting all Data
Concat = [ConcPTP1',ConcLin1']'; %%% ***my problem is here*** works only if everything is in one script
This works when everything is a single script but gives errors when I seperate the files as functions then call them from a main program. (The function method is needed). Everything else works fine, I only need to combine all the data from both functions as one ouput file.
Thank you in advance.
5 Commenti
James Tursa
il 18 Gen 2022
You need to return the ConcPTP1 and ConcLin1 variables as outputs from your functions. Can you show us the code for these function signatures and how you are currently calling them?
Walter Roberson
il 18 Gen 2022
As James suggests, add ConcLin1 as an output from Line(), and add ConcPTP1 as an output from Point()
Konard Adams
il 19 Gen 2022
[ConcPTP1',ConcLin1']'
Three ctranpose operations seems a bit inefficient: why not just concatenate with the correct orientation in the first place?
I am guessing something like this might wrk:
[ConcPTP1;ConcLin1]
Konard Adams
il 20 Gen 2022
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Data Type Identification in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!