Dot indexing not supported for variables of this type

1 回表示 (過去 30 日間)
Petra Dujmic
Petra Dujmic 2022 年 5 月 20 日
コメント済み: Petra Dujmic 2023 年 10 月 4 日
Hi! I am trying to run code on a set of biological images to analyze sarcomere organization and length (the SOTA code is developed by the authors of the Sutcliffe et. al. 2018 paper, and is available for download on github: https://github.com/saucermanlab/SarcOrgTextureAnalysis ), however, I keep getting the error message "Dot indexing is not supported for varibales of this type." I am new to MATLAB and thus am not entirely sure how to solve this issue. Any help or suggestions are appreciated:) The error lies in the third and fourth line of the code, "[eX,eY] = beeswarmPoints([eCM.all.SarcomereOrganizationScore],xspacing,(ylimits(2)-ylimits(1))/nBins,ylimits);"
%% Sarcomere Organization
ylimits = [0 0.6];
xlimits = [0.25 2.75];
[eX,eY] = beeswarmPoints([eCM.all.SarcomereOrganizationScore],xspacing,(ylimits(2)-ylimits(1))/nBins,ylimits);
[rX,rY] = beeswarmPoints([rCM.all_aact.SarcomereOrganizationScore],xspacing,(ylimits(2)-ylimits(1))/nBins,ylimits);
figure('units','pixels','position',[50 500 figureSize]); hold on;
plot(xlimits,sarcomereOrganizationThreshold.*[1 1],'k--','LineWidth',lw);
scatter(eX+1,eY,markerSize,'MarkerEdgeColor',[1 1 1],'MarkerFaceColor',eCM_color,'MarkerFaceAlpha',alphaValue);
plot3Lines([eCM.all.SarcomereOrganizationScore],1,xwidth,lw);
scatter(rX+2,rY,markerSize,'MarkerEdgeColor',[1 1 1],'MarkerFaceColor',rCM_color,'MarkerFaceAlpha',alphaValue);
plot3Lines([rCM.all_aact.SarcomereOrganizationScore],2,xwidth,lw);
% plot([0.9 1.1],mean([eCM.all.SarcomereOrganizationScore])*[1 1],'k');
% plot([1.9 2.1],mean([rCM.all_aact.SarcomereOrganizationScore])*[1 1],'k');
set(gca,'FontSize',fontSize,'LineWidth',lw,'Color','None','TickDir','out','TickLength',[0.02 0.025]);
xlim(xlimits);
ylim(ylimits);
set(gca,'YTick',0:0.1:0.6);
ylabel('Sarcomere organization');
set(gca,'XTick',[1 2],'XTickLabel',xticklabels);
set(gca,'Position',gcaPosition);
ax = gca;
ax.XAxis.Color = 'k';
ax.YAxis.Color = 'k';
  2 件のコメント
Walter Roberson
Walter Roberson 2022 年 5 月 21 日
either eCM or eCM.all is not a struct and not an object.
When you see this message it is common to find that the entry is empty, [] because something failed.
Petra Dujmic
Petra Dujmic 2023 年 10 月 4 日
Thank you!

サインインしてコメントする。

回答 (1 件)

prabhat kumar sharma
prabhat kumar sharma 2023 年 10 月 4 日
I understand that you are encountering an error with your code.
After cloning the repository and attempting to replicate the issue, I discovered that the variable eCM is a 1x1 struct. However, upon inspection, I found that eCM.all is empty (eCM.all = []). This is the reason for the error you are experiencing. The error occurs because there is no property named SarcomereOrganizationScore within the eCM.all struct.
To verify this, you can set the property SarcomereOrganizationScore before accessing it to avoid encountering this error. It is important to note that you cannot access a property that does not exist, which leads to the error in MATLAB.
If you have any further questions or need additional assistance, please let me know!
Tip: It’s always a good coding habit to null check the values before using.
  1 件のコメント
Petra Dujmic
Petra Dujmic 2023 年 10 月 4 日
Thank you so much for your help, I appreciate it!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by