Answered
How can I access the data stored in a 1x16 struct in a .mat file?
S = load('NoDotsAnalyzed.mat'); plot(S.data_dic_save.WhateverFieldYouWantToPlot) You need to know which field/s of the s...

8 years ago | 0

| accepted

Answered
Test existence of global variable within function?
You need to also explicitly declare that global variable inside the functions where you want to use it: function existing =...

8 years ago | 1

| accepted

Answered
Error trying to use a function within a function?
I don't get any error when I call your function: >> XYFromAngles(1,1,1) [x, y]= 0.27019 0.42080 ans = 0.2701...

8 years ago | 1

| accepted

Answered
Convert cell array to two row vector
Simpler: [hvix{:}] See: https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html https://www.mathworks.c...

8 years ago | 0

Answered
Matlab code for accessing different folder data
Very similar to the MATLAB documentation shows: https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files...

8 years ago | 0

Answered
Find common elements of two array with repetition????
[C,ia,ib] = intersect(A,B) For example: >> A = [1,2,3,4,5,6,7]; >> B = [2,3,4,8,9,0,7]; >> [C,ia,ib] = intersect...

8 years ago | 2

Answered
Index exceeds matrix dimensions using sprintf by calling mat files
Two important changes to make: # Do NOT use |eval|. # |load| into an output variable. If you had named the variables insi...

8 years ago | 1

| accepted

Answered
how to get .png image rgb values
RGB = imread(...)

8 years ago | 0

Answered
Are Tables or Structures better for this scenario?
Perhaps something like this (untested, because you have not given us any sample data): S = load('data.mat'); F = S.Raw.R...

8 years ago | 0

| accepted

Answered
how can I change the number of digits before decimal point?
Hmm, interesting problem. Here is one solution that lets you specify how many leading digits you want before the decimal point, ...

8 years ago | 2

| accepted

Answered
Finding specific combination of digits in pi
Use <https://www.mathworks.com/help/matlab/ref/strfind.html |strfind|>, like in this example: <https://www.mathworks.com/help...

8 years ago | 0

Answered
Count unique ID occurrences in a column after grouping based on another column
>> C = {'plane5';'plane5';'plane5';'plane8';'plane8';'plane6'}; >> V = [ 1; 1; 2; 1; 1; ...

8 years ago | 1

Answered
How do I get the proactive help on Matlab
@Tommi Karhinen: installed MATLAB has several ways to get help/tips while typing: <https://www.mathworks.com/help/matlab/matl...

8 years ago | 0

| accepted

Answered
Reusing results of previous function calls
|memoize| was introduced in R2017a: <https://www.mathworks.com/help/matlab/ref/memoize.html> <https://blogs.mathworks.com/...

8 years ago | 1

| accepted

Answered
How to use strsplit in cell arrays
>> B = {'Message_2 = hex2dec(''2'');','Message_4A = hex2dec(''4A'');'}; >> regexp(B,'(?<=\()[^)]+','once','match') ans =...

8 years ago | 0

| accepted

Answered
How to interpolate NaN values
>> X = isnan(A(:,4)); >> C = [1:3,5:8]; >> D = sum(bsxfun(@minus,permute(A(~X,C),[1,3,2]),permute(A(X,C),[3,1,2])).^2,3)...

8 years ago | 0

| accepted

Answered
Indexing values, selecting a range, and outputting values
Use logical indexing: >> A = [1 2 3 4 5 6 7 8 9 10]; >> B = [4 5 2 8 9 0 1 0 4 6 ]; >> C = B(A>=4 & A<=7) C = ...

8 years ago | 0

| accepted

Answered
I have three coloum data. I want to separate matched data into different files.
M = dlmread('data.txt'); [U,~,X] = unique(1e4*M(:,1)); for k = 1:numel(U) F = sprintf('data_%d.txt',k); T ...

8 years ago | 0

Answered
How to create array without cells
_"Basically I want to be able to use A(1,1,:) in the same way you would use a Matrix B(1,:)."_ MATLAB indexing works the same...

8 years ago | 0

| accepted

Answered
Store recursive intermediate values
*Method one: nested function:* which lets you keep any intermediate values that you want: function [Yout,C] = Laguerre(Xin,...

8 years ago | 1

| accepted

Answered
how can I find all the possible binaries matrices from a specifiec size?
>> A = reshape(dec2bin(0:15).',2,2,16) A = ans(:,:,1) = 00 00 ans(:,:,2) = 00 01 ans(:,:,3) = 01 ...

8 years ago | 2

Answered
How to create matrix with fixed sum in rows and fixed increment in elements
Straightforward exhaustive search which does not generate any superfluous rows: V = 0:5:100; Z = nan(0,3); for n1 = V...

8 years ago | 0

| accepted

Answered
Duration in double between two datenum
To get seconds simply multiply the days by 60*60*24: >> F = 'yyyy-mm-dd HH:MM:SS.FFF'; >> D = datenum('2018-09-07 18:36...

8 years ago | 1

| accepted

Answered
How would I go about writing a loop to solve for the unknown Temp that would make z = 1?
Turn the code into a function: function z = myfun(T) xe = 0.35; xw = 0.25; xb = 0.40; Pe = exp(18.5242 - ((3578...

8 years ago | 1

| accepted

Answered
How to count the number of occurrences of pixel intensities in an image without using for loop?
im = imread('image.jpg'); Rhist = imhist(im(:,:,1)); Ghist = imhist(im(:,:,2)); Bhist = imhist(im(:,:,3)); Or usin...

8 years ago | 0

| accepted

Answered
Appdesigner Question: Is it possible for a user to reset a default value?
_"... allow for a user to reset a default value so that it is recalled when the app is closed and reopened?"_ Simpler and mor...

8 years ago | 0

Answered
How to automatically split a matrix into multi-Vectors of n variables for combination?
This is easy with a comma-separated list: T = {[1,2,3],[4,5],6}; combvec(T{:}) https://www.mathworks.com/help/matlab/matlab_p...

8 years ago | 1

| accepted

Answered
I am not able to use eval for a string of variables in order to evaluate these variables in a multidimensional array.
Just use a cell array of indices, which is much simpler and much more efficient. And no loop is required either: X = randi(...

8 years ago | 0

| accepted

Answered
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 0-by-0. Error in newhallprobe (line 42) field(x,y)=str2num(fgets(s));
Do not use |str2num|, as it can return non-scalar arrays. (i.e. empty, like you are getting, or multiple elements), and it relie...

8 years ago | 0

Answered
Question with vectorisation?
Just use <https://www.mathworks.com/help/matlab/ref/randi.html |randi|> and define the output size: A(1:1000,1) = randi(5,1...

8 years ago | 0

Load more