Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Is there a way to input data into a function?

1 Ansicht (letzte 30 Tage)
병욱
병욱 am 11 Jul. 2024
Geschlossen: Angelo Yeo am 12 Jul. 2024
I apologize for not being able to upload the code due to its length. Only the data for weeks 1 and 5 is being applied, and although I have the data for weeks 2, 3, and 4, they all show up as 0. Could you please provide a solution for this issue?
  3 Kommentare
병욱
병욱 am 11 Jul. 2024
% 데이터 확인
disp('SumAbsJpCbnMeanAST(:,3,:) - SumAbsJpCbnMeanAST(:,1,:)');
data_diff = SumAbsJpCbnMeanAST(:,3,:) - SumAbsJpCbnMeanAST(:,1,:);
disp(data_diff);
% 평균과 표준편차 계산
meanData = reshape(mean(data_diff, 1), [1 5]);
stdData = reshape(std(data_diff, 0, 1), [1 5]);
% 디버깅 출력
disp('Mean Data:');
disp(meanData);
disp('Standard Deviation Data:');
disp(stdData);
% 오류 막대 그래프 그리기
figure(1112);
e6 = errorbar(1:5, meanData, stdData, '--o', 'MarkerSize', 10, 'LineWidth', 2);
e6.Color = [0.7 0.7 0.7];
e6.MarkerFaceColor = [0.7 0.7 0.7];
xlabel('week');
ylabel('JT Cbn');
disp(SumAbsJpCbnMeanAST(:,3,:));
disp(SumAbsJpCbnMeanAST(:,1,:));
size(SumAbsJpCbnMeanAST)
% 데이터 구조와 내용 확인
disp('Size of SumAbsJpCbnMeanAST:');
disp(size(SumAbsJpCbnMeanAST));
disp('Values of SumAbsJpCbnMeanAST(:,3,:):');
disp(SumAbsJpCbnMeanAST(:,3,:));
disp('Values of SumAbsJpCbnMeanAST(:,1,:):');
disp(SumAbsJpCbnMeanAST(:,1,:));
Here you are. I already debug it, i guess, code doesn't track the data.
병욱
병욱 am 11 Jul. 2024
figure(1112);
e6 = errorbar(1:5, reshape(mean(SumAbsJpCbnMeanAST(:,3,:)-SumAbsJpCbnMeanAST(:,1,:)), [1 5]), reshape(std(SumAbsJpCbnMeanAST(:,3,:)-SumAbsJpCbnMeanAST(:,1,:)), [1 5]), '--o', 'MarkerSize', 10, 'LineWidth', 2);
hold on;
e6.Color = [0.7 0.7 0.7];
e6.MarkerFaceColor = [0.7 0.7 0.7];
xlabel('week'); ylabel('Jp Cbn');
e7 = errorbar(1:5, reshape(mean(SumAbsJpMtpMeanAST(:,3,:)-SumAbsJpMtpMeanAST(:,1,:)), [1 5]), reshape(std(SumAbsJpMtpMeanAST(:,3,:)-SumAbsJpMtpMeanAST(:,1,:)), [1 5]), '--o', 'MarkerSize', 10, 'LineWidth', 2);
e7.Color = [0.6 0.6 0.6];
e7.MarkerFaceColor = [0.6 0.6 0.6];
xlabel('week'); ylabel('Jp Mtp');
e8 = errorbar(1:5, reshape(mean(SumAbsJpAnkMeanAST(:,3,:)-SumAbsJpAnkMeanAST(:,1,:)), [1 5]), reshape(std(SumAbsJpAnkMeanAST(:,3,:)-SumAbsJpAnkMeanAST(:,1,:)), [1 5]), '--o', 'MarkerSize', 10, 'LineWidth', 2);
e8.Color = [0.5 0.5 0.5];
e8.MarkerFaceColor = [0.5 0.5 0.5];
xlabel('week'); ylabel('Jp Ank');
e9 = errorbar(1:5, reshape(mean(SumAbsJpKneMeanAST(:,3,:)-SumAbsJpKneMeanAST(:,1,:)), [1 5]), reshape(std(SumAbsJpKneMeanAST(:,3,:)-SumAbsJpKneMeanAST(:,1,:)), [1 5]), '--o', 'MarkerSize', 10, 'LineWidth', 2);
e9.Color = [0.4 0.4 0.4];
e9.MarkerFaceColor = [0.4 0.4 0.4];
xlabel('week'); ylabel('Jp Kne');
e10 = errorbar(1:5, reshape(mean(SumAbsJpHipMeanAST(:,3,:)-SumAbsJpHipMeanAST(:,1,:)), [1 5]), reshape(std(SumAbsJpHipMeanAST(:,3,:)-SumAbsJpHipMeanAST(:,1,:)), [1 5]), '--o', 'MarkerSize', 10, 'LineWidth', 2);
e10.Color = [0.3 0.3 0.3];
e10.MarkerFaceColor = [0.3 0.3 0.3];
xlabel('week'); ylabel('Jp Hip');
hold off;
this is just short code, drawing graphs. When you check the functions starting with SumAbsJp~ in the workspace, the data for weeks 2, 3, and 4 appear as matrices filled with zeros.

Antworten (0)

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by